#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
upstream wedding_api {
server localhost:8080 fail_timeout=0;
}
###### XX项目#####
# server {
# listen 80;
# server_name aidunet.cn www.aidunet.cn;
# client_max_body_size 100M;
# location / {
# proxy_set_header Host $host;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_buffering off;
# proxy_pass http://wedding_api;
# }
# location /sv5V7VUcuV.txt {
# alias /opt/info/sv5V7VUcuV.txt;
# }
#}
###### XX项目#####
server {
listen 80;
server_name aidunet.cn www.aidunet.cn;
add_header Strict-Transport-Security max-age=15768000;
return 301 https://$server_name$request_uri;
}
#####https代理,此域名监听443端口(http默认监听443),以https协议访问#####
server {
listen 80 default backlog=2048;
listen 443 ssl;
server_name aidunet.cn www.aidunet.cn;
# 下面ssl开头的是HTTPS相关的设置
#ssl on; #把ssl on;这行去掉,ssl写在443端口后面。这样http和https的链接都可以用
ssl_certificate /usr/local/nginx/conf/cert/6573978_aidunet.cn_nginx/6573978_aidunet.cn.pem;
ssl_certificate_key /usr/local/nginx/conf/cert/6573978_aidunet.cn_nginx/6573978_aidunet.cn.key;
ssl_session_timeout 5m;#session有效期,根据需要适当延长
ssl_session_cache shared:SSL:10m;
# 使用的加解密方式
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
# 支持的协议类型
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
# 优先使用服务端的加解密方式
ssl_prefer_server_ciphers on;
location / {
# 单个服务
proxy_pass http://wedding_api;
# 负载均衡
# proxy_pass http://yourServers/;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
# 启用支持websocket连接
#proxy_set_header Upgrade $http_upgrade;
#proxy_set_header Connection "upgrade";
}
# 代理静态资源
location /files/ {
alias /project/uploadfile/wedding/;
try_files $uri $uri/;
index index.html index.htm;
}
}
############################################### XX目配置 end #################################
######婚庆文件#####
server {
listen 8888;
server_name localhost;
charset utf-8;
#access_log logs/host.access.log main;
#默认请求
location / {
root /project/uploadfile/wedding/;#定义服务器的默认网站根目录位置
index index.html index.php index.htm;#定义首页索引文件的名称
}
}
}
|