阅读 109

nginx 配置http,https,ip

http

server
 {
 	 listen 80;
 	 #listen [::]:80 default_server ipv6only=on;
 	 server_name smart.sqwisdom.net;
 	 index index.html index.htm admin.php;
 	 root /home/wwwroot/default/smart/smart-community/Public;
 	 #error_page 404 /404.html;
 	 include enable-php-pathinfo.conf;
 	 location /nginx_status
 	 {
 	 	stub_status on;
 	 	access_log off;
 	 }
 	 location / { 
 		 if (!-e $request_filename) { 
 			 rewrite ^/smart/(.*)$ /api.php?s=$1 last; 
 			 break; 
 			 rewrite ^(.*)$ /index.php?s=/$1 last; 
 		 }
 		 if (!-e $request_filename) { 
 			 rewrite ^(.*)$ /admin.php?s=$1 last; 
 		 } 
 	 } 
 	 location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
 	 {
 	 	expires 30d;
 	 }
 	 location ~ .*\.(js|css)?$
 	 {
 	 	expires 12h;
 	 }
 	 location ~ /\.
 	 {
 	 	deny all;
 	 }
 	 access_log /home/wwwlogs/access_smart.log;
 }

https

server
{
 	 listen 443 ssl;
 	 #listen [::]:80 default_server ipv6only=on;
 	 server_name smart.sqwisdom.net;
 	 index index.html index.htm admin.php;
 	 root /home/wwwroot/default/smart/smart-community/Public;
 	 #error_page 404 /404.html;
 	 include enable-php-pathinfo.conf;
	 
	 ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
	 ssl_certificate smart.sqwisdom.net_chain.crt;
	 ssl_certificate_key smart.sqwisdom.net_key.key;
	 ssl_prefer_server_ciphers on;

 	 location /nginx_status
 	 {
 	 	stub_status on;
 	 	access_log off;
 	 }
 	 location / { 
 		 if (!-e $request_filename) { 
 			 rewrite ^/smart/(.*)$ /api.php?s=$1 last; 
 			 break; 
 			 rewrite ^(.*)$ /index.php?s=/$1 last; 
 		 }
 		 if (!-e $request_filename) { 
 			 rewrite ^(.*)$ /admin.php?s=$1 last; 
 		 } 
 	 } 
 	 location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
 	 {
 	 	expires 30d;
 	 }
 	 location ~ .*\.(js|css)?$
 	 {
 	 	expires 12h;
 	 }
 	 location ~ /\.
 	 {
 	 	deny all;
 	 }
 	 access_log /home/wwwlogs/access_smart.log;
}

ip

server
 {
 	 listen 8089;
 	 #listen [::]:80 default_server ipv6only=on;
 	 server_name 127.0.0.1:8089;
 	 index index.html index.htm admin.php;
 	 root /home/wwwroot/default/smart/smart-community/Public;
 	 #error_page 404 /404.html;
 	 include enable-php-pathinfo.conf;
 	 location /nginx_status
 	 {
 	 	stub_status on;
 	 	access_log off;
 	 }
 	 location / { 
 		 if (!-e $request_filename) { 
 			 rewrite ^/smart/(.*)$ /api.php?s=$1 last; 
 			 break; 
 			 rewrite ^(.*)$ /index.php?s=/$1 last; 
 		 }
 		 if (!-e $request_filename) { 
 			 rewrite ^(.*)$ /admin.php?s=$1 last; 
 		 } 
 	 } 
 	 location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
 	 {
 	 	expires 30d;
 	 }
 	 location ~ .*\.(js|css)?$
 	 {
 	 	expires 12h;
 	 }
 	 location ~ /\.
 	 {
 	 	deny all;
 	 }
 	 access_log /home/wwwlogs/access_smart.log;
 }

原文:https://www.cnblogs.com/jiqing9006/p/14812200.html

文章分类
代码人生
版权声明:本站是系统测试站点,无实际运营。本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 XXXXXXo@163.com 举报,一经查实,本站将立刻删除。
相关推荐