• CentOS 7 安装Nginx并实现域名转发


    CentOS 7 条件

    教程中的步骤需要root用户权限。

    一、添加Nginx到YUM源

    添加CentOS 7 Nginx yum资源库,打开终端,使用以下命令:

    sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

    二、安装Nginx

    在你的CentOS 7 服务器中使用yum命令从Nginx源服务器中获取来安装Nginx:

    sudo yum install -y nginx

    Nginx将完成安装在你的CentOS 7 服务器中。

    三、启动Nginx

    刚安装的Nginx不会自行启动。运行Nginx:

    sudo systemctl start nginx.service

    如果一切进展顺利的话,现在你可以通过你的域名或IP来访问你的Web页面来预览一下Nginx的默认页面;

    打开/etc/nginx/文件夹下找到nginx.conf文件打开进行编辑

    user  nginx;
    worker_processes  1;
    
    error_log  /var/log/nginx/error.log warn;
    pid        /var/run/nginx.pid;
    
    
    events {
        worker_connections  1024;
    }
    
    
    http {
        include       /etc/nginx/mime.types;
        default_type  application/octet-stream;
    
        log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                          '$status $body_bytes_sent "$http_referer" '
                          '"$http_user_agent" "$http_x_forwarded_for"';
    
        access_log  /var/log/nginx/access.log  main;
    
        sendfile        on;
        #tcp_nopush     on;
    
        keepalive_timeout  65;
    
        server
        {
            listen 80;
            server_name www.xxxx.com;
            location / {
                proxy_redirect off;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_pass http://xxxxx:8088;
            }
       
        }
    
    
        #gzip  on;
    
        include /etc/nginx/conf.d/*.conf;
    }

    主要是添加server块代码

  • 相关阅读:
    R-CNN/Fast R-CNN/Faster R-CNN
    RNN的介绍
    前向传播算法(Forward propagation)与反向传播算法(Back propagation)
    world转.md
    msgid 属性
    .equals()到底是什么意思?
    iperf详细使用方法
    c语言#define用法
    android源码编译出现No private recovery resources for TARGET_DEVICE解决方法
    nginx File not found 错误
  • 原文地址:https://www.cnblogs.com/lkd3063601/p/8744547.html
Copyright © 2020-2023  润新知