博客为日常工作学习积累总结:

1.安装依赖包

      安装pcre :yum install pcre pcre-devel -y

           安装openssl:yum install openssl openssl-devel -y

           检查安装包:rpm -qa pcre pcre-devel

                   pcre-7.8-7.el6.x86_64

                   pcre-devel-7.8-7.el6.x86_64

           切换至国内yum源:wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

           安装nginx:地址:http://nginx.org/download/nginx-1.14.2.tar.gz

      创建安装用户:useradd oldboy    passwd oldboy

           放置路径:/home/oldboy/tools

               网络下载:wget -q http://nginx.org/download/nginx-1.14.2.tar.gz

               解压:tar xf nginx-1.14.2.tar.gz

ls           auto  CHANGES  CHANGES.ru  conf  configure  contrib  html  LICENSE  man  README  src

查看nginx安装包:yum list | grep nginx

     为配置文件添加用户:useradd nginx

              配置文件:./configure --prefix=/application/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_mp4_module --with-http_flv_module

           ./configure --help

         编译:make (make & make install)

        编译后安装:make install

              将带版本的去掉创建软连接:ln -s /application/nginx-1.6.3/ /application/nginx

    启动:/application/nginx/sbin/nginx

查询端口:netstat -lntup|grep 80       lsof -i :80

查看nginx版本:/application/nginx/sbin/nginx -V

              优化去掉注释:egrep -v "#|^$" nginx.conf.default >nginx.conf

               /application/nginx/sbin/nginx -t

               /application/nginx/sbin/nginx -s reload

        ln -n /application/nginx/sbin/nginx  /usr/bin/nginx

2.设置开机自启动:

      参考链接:https://www.cnblogs.com/jepson6669/p/9131217.html

      进入到:cd /lib/systemd/system/

      创建服务文件:vim nginx.service

 [Unit]
Description=nginx service
After=network.target [Service]
Type=forking
ExecStart=/application/nginx/sbin/nginx
ExecReload=/application/nginx/sbin/nginx -s reload
ExecStop=application/nginx/sbin/nginx -s quit
PrivateTmp=true [Install]
WantedBy=multi-user.target

      加入开机自启动:systemctl enable nginx

      取消开机自启动:systemctl disable nginx

      常用命令使用:          

            systemctl start nginx.service          启动nginx服务

            systemctl stop nginx.service           停止服务

            systemctl restart nginx.service        重新启动服务

            systemctl list-units --type=service     查看所有已启动的服务

            systemctl status nginx.service          查看服务当前状态

            systemctl enable nginx.service          设置开机自启动

            systemctl disable nginx.service         停止开机自启动

      常见错误处理:systemctl daemon-reload

3.跑一个项目测试:

 worker_processes  ;

 events {

     worker_connections  ;

 }

 http {

     include       mime.types;

     default_type  application/octet-stream;

     sendfile        on;

     keepalive_timeout  ;

     upstream ofmovie {

         server 192.168.50.188:;

         server 192.168.50.188:;

         server 192.168.50.188:;

         server 192.168.50.188:;

     }

     server {

         listen       ;

         server_name  ofmovie.flybird.com;

         location / {

             root   html;

             index  index.html index.htm;

             proxy_pass http://ofmovie;

         }

     }

 }

     

        运行自己做的项目:

          [root@mould ~]# cd /data/movie/

          nohup python manage.py runserver -h 192.168.50.188 -p 5001

          nohup python manage.py runserver -h 192.168.50.188 -p 5002

          nohup python manage.py runserver -h 192.168.50.188 -p 5003

          nohup python manage.py runserver -h 192.168.50.188 -p 5004

04.nginx使用的更多相关文章

  1. Ubuntu14.04(nginx+php+mysql+vsftp)配置安装流程

    Ubuntu14.04(nginx+php+mysql+vsftp)配置安装流程 1.先切换到root用户 sudo  su 2.更新软件源 apt update apt-get upgrade 3. ...

  2. zabbix快速安装(Ubuntu18.04, Nginx)

    ubuntu18.04快速安装zabbix4.0 https://blog.csdn.net/qq_33317586/article/details/83867756 需要安装的东西:nginx,ph ...

  3. 04 . Nginx的Rewrite重写

    Rewrite简介 # Rewrite对应URL Rewrite,即URL重写,就是把传入web的请求重定向到其他URL的过程. # 当运维遇到要重写情况时,往往是要程序员把重写规则写好后,发给你,你 ...

  4. 阿里云Ubuntu 14.04 + Nginx + let's encrypt 搭建https访问

    参考页面: https://certbot.eff.org/#ubuntutrusty-nginx http://bbs.qcloud.com/thread-12059-1-1.html http:/ ...

  5. 04: nginx部署vue

    1.1 基本配置 server { listen 9000; server_name 1.1.1.3; #access_log logs/access_example.log main; root / ...

  6. ubuntu14.04 +nginx+php5-fpm

    一,安装Nginx apt-get install nginx 1,配置nginx nginx所有的配置在 /etc/nginx/nginx.conf中 nginx.conf配置里面包括了 inclu ...

  7. ubuntu 13.04 nginx.conf 配置详解

    1.nginx.conf 文件,路径为:/etc/nginx/agin.conf #使用的用户和组 user www-data; #指定工作衍生进程数(一般等于CPU总核数或总核数的两倍) worke ...

  8. ubuntu16.04 nginx安装

    .gcc.g++依赖库 apt-get install build-essential apt-get install libtool .安装 pcre依赖库(http://www.pcre.org/ ...

  9. 阿里云Ubuntu 14.04 + Nginx + .net core + MySql

    前段时间帮朋友写了一个网站,现在做一个记录. .Net Core 安装: curl https://packages.microsoft.com/keys/microsoft.asc | gpg -- ...

随机推荐

  1. 云栖神侠传—阿里云数据库专家德歌告诉你PostgreSQL的那些事

    什么是云栖神侠传: 云栖社区(http://yq.aliyun.com/?utm_source=yqdg),是阿里云面向开发者群体的开放型社区.在云栖社区中,活跃着许多阿里技术大牛,他们在自己的技术领 ...

  2. Python学习系列----第三章 控制流

    在python中有三种控制流语句,分别是: if.for.while. 2.1 if 语句 if 语句用来检验一个条件,如果条件为真,我们运行一块语句(称为 if-块),否 则我们处理另外一块语句(称 ...

  3. 【Leetcode】【Medium】Partition List

    Given a linked list and a value x, partition it such that all nodes less than x come before nodes gr ...

  4. ASP.NET Core - 中间件与管道(1)

    今天来讨论一个ASP.NET Core 很重要概念管道和中间件,在ASP.NET Core中,针对HTTP请求采用pipeline也就是通常说的管道方式来处理,而管道容器内可以挂载很多中间件(处理逻辑 ...

  5. 【2017.09.15 智能驾驶/汽车电子】汽车高级驾驶辅助ADAS常用传感器厂商:激光雷达篇

    不定期更新,主要是汇总Internet上的激光雷达厂商资讯,不涉及技术,以备参考. 1. Innoviz:固态激光雷达公司 新闻链接:http://36kr.com/p/5092055.html 激光 ...

  6. 019sys模块

    为了和python解释器交互,控制台执行脚本后面添加变量 import  sysprint(sys.argv) def  post():    print('upload')def  download ...

  7. BZOJ4827:[HNOI2017]礼物(FFT)

    Description 我的室友最近喜欢上了一个可爱的小女生.马上就要到她的生日了,他决定买一对情侣手环,一个留给自己,一 个送给她.每个手环上各有 n 个装饰物,并且每个装饰物都有一定的亮度.但是在 ...

  8. import(导入)过期的磁带 -----先留个引子,后期更改补充

    在某些情况下,客户需要恢复已经过期的磁带上的数据, 如果磁带没有被重新使用,数据没有被覆盖掉,可以使用 netbackup 的 import 方法将过期的磁带上的数据 import 到 netback ...

  9. 字符串匹配KMP算法(转自阮一峰)

    转自 http://www.ruanyifeng.com/blog/2013/05/Knuth%E2%80%93Morris%E2%80%93Pratt_algorithm.html 字符串匹配是计算 ...

  10. Codeforces Round #533 (Div. 2) B. Zuhair and Strings 【模拟】

    传送门:http://codeforces.com/contest/1105/problem/B B. Zuhair and Strings time limit per test 1 second ...