• nginx安装步骤


    1.下载地址:下载nginx压缩包
    wget -c https://nginx.org/download/nginx-1.10.1.tar.gz
    2.配置nginx安装所需的环境
    yum install gcc-c++ -y
    2.1. 安装PCRE pcre-devel
    yum install -y pcre pcre-devel
    3. 安装zlib
    yum install -y zlib zlib-devel
    4. 安装Open SSL
    yum install -y openssl openssl-devel
    解压nginx压缩包并安装
    tar -zxvf nginx-1.10.1.tar.gz
    进入解压后的文件夹目录下
    cd nginx-1.10.1/
    显示所有信息
    ll
    进入nginx里面,使用默认配置,然后回车即可
     ./configure
    4. 编译安装nginx(这里和redis的编译安装比较类似,首先在当前目录(/usr/local/nginx-1.10.1)进行编译。输入make即可)
    make
     make install
    ok,安装成功。这时候返回上一级目录,就会发现多了nginx目录,接下来,启动nginx。
    cd.. 返回上一级
    进入sbin目录:
    cd /usr/local/nginx/sbin
    启动nginx
    ./nginx
    关闭nginx
    ./nginx -s quit  或者 ./nginx -s stop
    重启nginx
    ./nginx -s reload
    查看nginx进程
    ps aux|grep nginx

    关闭防火墙
    Centos7 禁止firewalld并使用iptables 作默认防火墙
    systemctl stop firewalld.service
    systemctl stop firewalld
    永久关闭防火墙:
    systemctl disable firewalld
    systemctl disable firewalld.service
    永久开启防火墙:
    systemctl enable firewalld.service

    设置nginx开机启动,只需在rc.local增加启动代码即可。
    vim /etc/rc.local  进入配置文件将nginx开启路径加入

    设置nginx开机启动,只需在rc.local增加启动代码即可。
    /usr/local/nginx/sbin/nginx

    chmod a+x /etc/rc.local  使系统配置文件生效


    ---------------------------------------------------------------------

    nginx 配置80端口绑定域名
    server {
            listen       80;
            server_name  ypdx.dream-it.cn;
            proxy_buffering off;
            location / {
                    proxy_pass http://192.168.1.152;
                    proxy_set_header X-Real-IP $remote_addr;
                    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            }
    --------------------------------------------------------------------------------------------------

    nginx 配置443端口绑定域名 ssl证书https

    server {
    listen 443 ssl;
    server_name wangxy.xyz;
    access_log logs/aa.log;
    ssl on;
    root html;
    index index.html index.htm;

    ssl_certificate cert/3883388_wangxy.xyz.pem;
    ssl_certificate_key cert/3883388_wangxy.xyz.key;
    ssl_session_timeout 5m;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;

    location /LsdxAppDownload/ {
    proxy_pass http://192.168.1.76/LsdxAppDownload/downloadStudent.html;
    proxy_cookie_path /LsdxAppDownload/ /;
    proxy_set_header Host $host:$server_port;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;


    }

  • 相关阅读:
    android 源码下载(Windows+Linux)
    Android Studio依赖包冲突 Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
    深入了解Java--1 绪论
    Android Studio 找不到R文件解决方法汇总
    Git学习历程
    word自动生成目录左对齐(缩进)问题
    Android Studio simpleUML(UML工具)使用详解
    android studio 常用快捷键
    当我们提起“女性权益”的时候,我们到底指的是什么?
    weakref模块和弱引用
  • 原文地址:https://www.cnblogs.com/Dreamsoft/p/10435784.html
Copyright © 2020-2023  润新知