ubuntu16.04 or 18.04
nginx代理安装
安装
sudo apt-get install nginx
版本检查
nginx -v
'''
nginx version: nginx/1.14.0 (Ubuntu)
nginx 配置
进入nginx目录
cd /etc/nginx/
配置 nginx.conf 代理本地文件夹
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
server {
listen 85;
server_name localhost;
location /images/ {
alias /###localpath/;
#index.php index.html index.htm;
try_files $uri $uri/ /index.html last;
index index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
配置成功后运行
sudo nginx -t
显示运行成功后,重启下nginx
sudo nginx -s reload
打开浏览器检查是否代理成功