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


 

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

  1.  1         #相当于在http模块再添加一个server模块
     2         server {
     3             #监听绑定80端口
     4             listen       80;
     5             #下面这个是域名,多个域名用空格隔开
     6             server_name  www.a.com bb.com;
     7             #本网站的根路径
     8             root   /绝对路径;
     9             #下面是默认首页
    10             location / {
    11                 index  index.html index.php;
    12             }
    13             #下面是针对本站所有.php文件进行处理的配置
    14             location ~ \.php{
    15                 #加载fastcgi  一种处理方式
    16                  include fastcgi_params;
    17                 #fastcgi的参数 指定文件路径及参数,否则会有404或是file not find 提示
    18                 fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
    19                 #fastcgi的服务信息 ip:端口
    20                 fastcgi_pass 127.0.0.1:9000;
    21                 #fastcgi默认首页
    22                 fastcgi_index index.php;
    23             }
    24         }


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM