cfsky 发表于 2017-12-23 16:44:18

如何设置nginx的虚拟域名及访问目录

  首先进入nginx的配置文件nginx.conf;


[*]  

         #相当于在http模块再添加一个server模块  

         server {  

             #监听绑定80端口  

             listen       80;  

             #下面这个是域名,多个域名用空格隔开  

             server_namewww.a.com bb.com;  

             #本网站的根路径  

             root   /绝对路径;  

             #下面是默认首页  

             location / {  

               indexindex.html index.php;  

             }  

             #下面是针对本站所有.php文件进行处理的配置  

             location ~ \.php{  

               #加载fastcgi一种处理方式  

                  include fastcgi_params;  

               #fastcgi的参数 指定文件路径及参数,否则会有404或是file not find 提示  

               fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;  

               #fastcgi的服务信息 ip:端口  

               fastcgi_pass 127.0.0.1:9000;  

               #fastcgi默认首页  

               fastcgi_index index.php;  

             }  

         }  


页: [1]
查看完整版本: 如何设置nginx的虚拟域名及访问目录