配置nginx局域網內可訪問


  1. #本機  
  2. server {  
  3.         listen       80;  
  4.         server_name  www.stat.me ;  
  5.         root   "E:/lein/rkts/rkts/code/stat/public";  
  6.           
  7.         autoindex off;  
  8.   
  9.         location / {  
  10.           index  index.html index.htm index.php;  
  11.           #try_files $uri $uri/ /server.php?/$uri;  
  12.           try_files $uri $uri/ /index.php?$query_string;  
  13.         }  
  14.   
  15.         location ~ \.php(.*)$ {  
  16.             fastcgi_pass   127.0.0.1:9000;  
  17.             fastcgi_index  index.php;  
  18.             fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;  
  19.             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;  
  20.             fastcgi_param  PATH_INFO  $fastcgi_path_info;  
  21.             fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;  
  22.             include        fastcgi_params;  
  23.         }  
  24. }  
  25.   
  26. #供局域網內其他機器訪問  
  27. server {  
  28.         listen       8090;  
  29.         server_name  192.168.115.197:8090 ;  
  30.         root   "E:/lein/rkts/rkts/code/stat/public";  
  31.           
  32.         autoindex off;  
  33.   
  34.         location / {  
  35.           index  index.html index.htm index.php;  
  36.           #try_files $uri $uri/ /server.php?/$uri;  
  37.           try_files $uri $uri/ /index.php?$query_string;  
  38.         }  
  39.   
  40.         location ~ \.php(.*)$ {  
  41.             fastcgi_pass   127.0.0.1:9000;  
  42.             fastcgi_index  index.php;  
  43.             fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;  
  44.             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;  
  45.             fastcgi_param  PATH_INFO  $fastcgi_path_info;  
  46.             fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;  
  47.             include        fastcgi_params;  
  48.         }  
  49. }  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM