美文网首页
Nginx转发,部署网站相关linux命令

Nginx转发,部署网站相关linux命令

作者: 吖蛋黄 | 来源:发表于2018-07-12 18:06 被阅读0次

进入目录
cd /etc/nginx/sites-available

进入文件default
sudo vim default;

编辑
a

鼠标右键粘贴

退出编辑
Esc

保存
:wq

重启Nginx服务
sudo service nginx restart

清空default里面的内容
sudo sh -c 'encho "" >default'

创建manage-front文件,并复制cib-front到manage-front中:
sudo sh -c 'cat cib-front >> manage-front'

创建软链接
sudo ln -s /etc/nginx/sites-available/manage-front /etc/nginx/sites-enabled/manage-front

检查
sudo nginx -t

查看文件(行数)
less -N manage-front

删除文件
sudo sh -c 'rm -rf ./manage'

历史输入记录
histroy


# should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Default server configuration
#


server {
    listen 81 default_server;

    # SSL configuration
    #
    # listen 443 ssl default_server;
    # listen [::]:443 ssl default_server;
    #
    # Self signed certs generated by the ssl-cert package
    # Don't use them in a production server!
    #
    # include snippets/snakeoil.conf;

    #root /var/www/html;
    root /home/debian/cib-front; 

    # Add index.php to the list if you are using PHP
    index index.html index.htm index.nginx-debian.html;

    server_name _;

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;
    }

    # CIB项目
    location /cof-cib {
             # 转发
             proxy_pass          http://192.168.10.170:8886/;
             proxy_redirect      off;
             proxy_set_header    Host             $host;
             # 获取真实 IP
             proxy_set_header    X-Real-IP        $remote_addr;
             proxy_set_header    X-Forwarded-For  $proxy_add_x_forwarded_for;
             proxy_set_header    X-Client-Verify  SUCCESS;
             proxy_set_header    X-SSL-Subject    $ssl_client_s_dn;
             proxy_set_header    X-SSL-Issuer     $ssl_client_i_dn;
             proxy_read_timeout  65;
             client_max_body_size    250m;
    }

}

image.png image.png

相关文章

网友评论

      本文标题:Nginx转发,部署网站相关linux命令

      本文链接:https://www.haomeiwen.com/subject/ubvrpftx.html