有关nginx的配置文件 之server

下面是vhost中的其中一个xxxx.conf文件 . 
[Shell] 纯文本查看 复制代码
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#相当于在http模块再添加一个server模块
server {
#监听绑定80端口
    listen       80;
#下面这个是域名,多个域名用空格隔开
    server_name  www.php20.com php20.com;
#本网站的根路径
    root   /绝对路径;
#下面是默认首页
    location / {
        index  index.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;
    }
}


以下代码可增删除 具体可参考首页
 
 
 
原文地址:https://www.cnblogs.com/ghjbk/p/6727612.html