码迷,mamicode.com
首页 > 其他好文 > 详细

各个nginx conf的虚拟主机的配置

时间:2018-12-08 17:02:12      阅读:200      评论:0      收藏:0      [点我收藏+]

标签:user   key   charset   permanent   try_files   add   win   ams   dir   

server {
listen 80;
server_name t-cl.orangevip.com;
rewrite ^(.*)$ https://$host$1 permanent;
}


server {
listen 443;
server_name t-cl.orangevip.com;
charset utf-8;
gzip_min_length 20;

root /data/www/otm_build/nweb/;
access_log logs/cl_access.log main;

ssl on;
ssl_certificate /usr/local/nginx/cert/214719813310685.pem;
ssl_certificate_key /usr/local/nginx/cert/214719813310685.key;

if ($http_user_agent ~* "qihoobot|Baiduspider|Googlebot|Googlebot-Mobile|Googlebot-Image|Mediapartners-Google|Adsbot-Google|Feedfetcher-Google|YoudaoBot|Sosospider") {
return 403;
}

if ( $http_user_agent ~* "(Android|iPhone|Windows Phone|UC|Kindle)" ){
rewrite ^/(.*)$ https://t-m.orangevip.com$uri permanent;
}

location / {
if ($request_uri !~* \.(js|css|png|jpg|gif|jpeng|woff|bmp|svg|xml|pdf))
{
add_header Set-Cookie "ogreferrer=$http_referer;path=/";
}
proxy_pass http://nuxtserver1;
proxy_set_header referer $http_referer;
}
location ~* MP_verify_8MbQcTrP1mylRiqR\.txt {
try_files $uri $uri/;
}

#location ~ ^/m {
# rewrite ^/(.*)$ https://t-m.orangevip.com$uri permanent;
#}

#location /m/ {
# if ( $http_user_agent ~* "(Android|iPhone|Windows Phone|UC|Kindle)" ){
# rewrite ^/(.*)$ https://t-m.orangevip.com$uri permanent;
# }
# try_files $uri $uri/ /m/index.html;
#}
#location = /m {
# if ( $http_user_agent ~* "(Android|iPhone|Windows Phone|UC|Kindle)" ){
# rewrite ^/(.*)$ https://t-m.orangevip.com permanent;
# }
# try_files $uri $uri/ /m/index.html;
#}

#location / {
# try_files $uri/web $uri/web/ /web/index/index.html;
#}

#location ~.*\.(js|css|html|png|jpg)$ {
# expires 7d;
#}

}

 

移动端

server {
listen 80;
server_name t-m.orangevip.com;
rewrite ^(.*)$ https://$host$1 permanent;
}


server {
listen 443;
server_name t-m.orangevip.com;
charset utf-8;
gzip_min_length 20;

root /data/www/otm_build/m/;
access_log logs/m_access.log main;

ssl on;
ssl_certificate /usr/local/nginx/cert/214719813310685.pem;
ssl_certificate_key /usr/local/nginx/cert/214719813310685.key;

if ($http_user_agent ~* "qihoobot|Baiduspider|Googlebot|Googlebot-Mobile|Googlebot-Image|Mediapartners-Google|Adsbot-Google|Feedfetcher-Google|YoudaoBot|Sosospider") {
return 403;
}

location / {
if ($request_uri !~* \.(js|css|png|jpg|gif|jpeng|woff|bmp|svg|xml|pdf))
{
add_header Set-Cookie "ogreferrer=$http_referer;path=/";
}
proxy_pass http://nuxtserver2;
proxy_set_header referer $http_referer;
}

location = /m {
rewrite ^/(.*)$ https://t-m.orangevip.com permanent;
}

# location ~* MP_verify_8MbQcTrP1mylRiqR\.txt {
# try_files $uri $uri/;
# }

}

 

 

php

server {
listen 80;
server_name t-tiku.orangevip.com;
return 301 https://$server_name$request_uri;
}
server
{
listen 443;
server_name t-tiku.orangevip.com;

index index.php;
root /data/www/tecmz/public;

access_log logs/tiku_access.log;
ssl_certificate /usr/local/nginx/cert/214719813310685.pem;
ssl_certificate_key /usr/local/nginx/cert/214719813310685.key;

charset utf-8;

location ^~ /.git {
deny all;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9001;
# fastcgi_pass 192.168.0.163:9000;
fastcgi_index index.php;
#fastcgi_param PHP_VALUE "open_basedir=/data/www/:/tmp/:/var/tmp/";
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ \.(gif|jpg|jpeg|png|bmp|ico|css|js)$ {
expires max;
}
location ~* \.(eot|ttf|woff|woff2)$ {
add_header Access-Control-Allow-Origin ‘*‘;
}
}

 

各个nginx conf的虚拟主机的配置

标签:user   key   charset   permanent   try_files   add   win   ams   dir   

原文地址:https://www.cnblogs.com/matengfei123/p/10088064.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!