nginx配置记录

1.配置上下文反向代理

server {
listen 80;
server_name 127.0.0.1;
charset utf-8;
location /seller/ {
proxy_pass http://127.0.0.1:8000/seller/;
}
}

2.配置SSL

server {
listen 443 ssl;
server_name 127.0.0.1;
charset utf-8;
ssl_certificate ../shentb_ssl/full_chain.ctr;
ssl_certificate_key ../shentb_ssl/private.key;
location /seller/ {
proxy_pass http://127.0.0.1:8000/seller/;
}
}

3.配置监听多端口

server {
listen 80;
server_name 127.0.0.1;
charset utf-8;
location /seller/ {
proxy_pass http://127.0.0.1:8000/seller/;
}
}
server {
listen 8080;
server_name 127.0.0.1;
charset utf-8;
location /seller/ {
proxy_pass http://127.0.0.1:8000/seller/;
}
}

4.配置访问静态资源

server {
listen 443 ssl;
server_name 127.0.0.1;
charset utf-8;
ssl_certificate ../shentb_ssl/full_chain.ctr;
ssl_certificate_key ../shentb_ssl/private.key;
location / {
root /home/yangkunlin/shentb/index;
index index.html index.htm;
}
}

5.配置启动用户

去掉上边的 #user nobody
修改为 user 用户名 用户组:user root root

6.配置校验

./nginx -t

你可能感兴趣的:(nginx配置记录)