Nginx + 反向代理

1. 安装Nginx

sudo apt-get update sudo apt-get install nginx

2. 设置防火墙

  1. 查看防火墙允许访问的应用
    sudo ufw app list
    
    out put
    Available applications:
    Nginx Full  #80与443端口
    Nginx HTTP  #80端口
    Nginx HTTPS #443端口
    OpenSSH     #21端口
    
  2. 如果你发现Nginx上述应用为被允许访问
    #允许端口访问
    sudo ufw allow 'Nginx HTTP'
    #参看状态
    sudo ufw status
    

3. 检查web服务器

systemctl status nginx

4. 服务配置

cd /etc/nginx nginx配置文件目录,nginx所有配置文件都在这个文件夹里

/etc/nginx/nginx.conf nginx的主配置文件,该文件的修改,会改变Nginx的全局配置。

/etc/nginx/sites-available/ /etc/nginx/sites-enabled/ pre-site "server blocks"存放目录。Nginx不会使用该文件夹中的配置文件,除非link到sites-enable文件夹中。 通常,所有的服务block 配置文件在这个文件夹下设置完成,然后link到sites-enabled中去。

/etc/nginx/snippets: This directory contains configuration fragments that can be included elsewhere in the Nginx configuration. Potentially repeatable configuration segments are good candidates for refactoring into snippets.

results matching ""

    No results matching ""