进入nginx安装目录的conf目录下,编辑nginx.conf
server {
listen 80;
server_name www.chenlilin.cn;
location /{
root /usr/local/nginx/www;
proxy_pass http://localhost:8070;
#root html;
index index.html index.htm;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 100m;
}
error_page 500 502 503 504 /50x.html;
}
# HTTPS server https配置
server {
listen 443 ssl;
server_name www.chenlilin.cn;
# https证书
ssl_certificate cert.pem;
# https证书
ssl_certificate_key cert.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
location /{
root /usr/local/nginx/www;
proxy_pass http://localhost:8070;
#root html;
index index.html index.htm;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 100m;
}
}