nginx 配置文件
静态
server {
listen 443 ssl http2;
server_name download.mexmarkets.com ;
ssl_certificate /etc/nginx/conf.d/ssl/mexmarkets.crt;
ssl_certificate_key /etc/nginx/conf.d/ssl/mexmarkets.key;
root /var/uploads/download;
location / {
index index.html index.htm;
}
location /news/ {
alias /var/uploads/news/;
}
}
server {
listen 80;
server_name download.mexmarkets.com;
return 301 https://$server_name$request_uri;
}
其他:
server {
listen 443 ssl http2;
server_name www.mexgp.com zh.mexgp.com;
ssl_certificate /etc/nginx/conf.d/ssl/mexgp.crt;
ssl_certificate_key /etc/nginx/conf.d/ssl/mexgp.key;
location / {
proxy_redirect off;
proxy_pass http://mexgroup-cn;
proxy_http_version 1.1;
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 500m; #允许客户端请求的最大单文件字节数
client_body_buffer_size 20m; #缓冲区代理缓冲用户端请求的最大字节数
proxy_connect_timeout 300; #nginx跟后端服务器连接超时时间(代理连接超时)
proxy_send_timeout 300; #后端服务器数据回传时间(代理发送超时)
proxy_read_timeout 300; #连接成功后,后端服务器响应时间(代理接收超时)
proxy_buffer_size 128k; #设置代理服务器(nginx)保存用户头信息的缓冲区大小
proxy_buffers 100 128k; #proxy_buffers缓冲区,网页平均在32k以下的话,这样设置
proxy_busy_buffers_size 128k; #高负荷下缓冲大小(proxy_buffers*2)
proxy_temp_file_write_size 128k; #设定缓存文件夹大小,大于这个值,将从upstream服务器传
if ($request_filename ~* .*\.(?:js|css|jpg|png|gif|jpeg|pdf|PDF|ico)$)
{
expires 3h;
}
}
location /news/ {
limit_req zone=cdn_zone burst=10 nodelay;
proxy_http_version 1.1;
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_set_header X-Forwarded-Proto $scheme;
proxy_pass http://mexgroup-cn-news/;
proxy_redirect off;
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
client_max_body_size 500m; #允许客户端请求的最大单文件字节数
client_body_buffer_size 20m; #缓冲区代理缓冲用户端请求的最大字节数
proxy_connect_timeout 300; #nginx跟后端服务器连接超时时间(代理连接超时)
proxy_send_timeout 300; #后端服务器数据回传时间(代理发送超时)
proxy_read_timeout 300; #连接成功后,后端服务器响应时间(代理接收超时)
proxy_buffer_size 128k; #设置代理服务器(nginx)保存用户头信息的缓冲区大小
proxy_buffers 100 128k; #proxy_buffers缓冲区,网页平均在32k以下的话,这样设置
proxy_busy_buffers_size 128k; #高负荷下缓冲大小(proxy_buffers*2)
proxy_temp_file_write_size 128k; #设定缓存文件夹大小,大于这个值,将从upstream服务器传
if ($request_filename ~* .*\.(?:js|css|jpg|png|gif|jpeg|pdf|PDF|ico)$)
{
expires 3h;
}
}
location /school/ {
limit_req zone=cdn_zone burst=10 nodelay;
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
proxy_http_version 1.1;
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_set_header X-Forwarded-Proto $scheme;
proxy_pass http://mexgroup-cn-school/;
proxy_redirect default;
client_max_body_size 500m; #允许客户端请求的最大单文件字节数
client_body_buffer_size 20m; #缓冲区代理缓冲用户端请求的最大字节数
proxy_connect_timeout 300; #nginx跟后端服务器连接超时时间(代理连接超时)
proxy_send_timeout 300; #后端服务器数据回传时间(代理发送超时)
proxy_read_timeout 300; #连接成功后,后端服务器响应时间(代理接收超时)
proxy_buffer_size 128k; #设置代理服务器(nginx)保存用户头信息的缓冲区大小
proxy_buffers 100 128k; #proxy_buffers缓冲区,网页平均在32k以下的话,这样设置
proxy_busy_buffers_size 128k; #高负荷下缓冲大小(proxy_buffers*2)
proxy_temp_file_write_size 128k; #设定缓存文件夹大小,大于这个值,将从upstream服务器传
}
location /lp/touzi2020_list {
auth_basic "Admin Login";
auth_basic_user_file /etc/nginx/conf.d/password/touzi.pw;
proxy_pass http://mexgroup-cn/lp/touzi2020_list;
proxy_http_version 1.1;
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_set_header X-Forwarded-Proto $scheme;
}
location /mask_list{
auth_basic "Admin Login";
auth_basic_user_file /etc/nginx/conf.d/password/touzi.pw;
proxy_pass http://mexgroup-cn/mask_list;
proxy_http_version 1.1;
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_set_header X-Forwarded-Proto $scheme;
}
location /ikonvideo/ {
alias /var/www/html/ikoncapital_co_uk/sites/all/themes/dubai/video/;
}
}
server {
listen 80;
server_name www.mexgp.com;
return 301 https://$server_name$request_uri;
}
server {
listen 80;
server_name zh.mexgp.com;
return 301 https://$server_name$request_uri;
}