nginx配置虚拟主机

来源:互联网 发布:js 取反运算符 编辑:程序博客网 时间:2024/06/17 15:54

1.  nginx.conf 文件中最后一句


include vhosts.conf;



2. include vhosts.conf文件加入要配置的虚拟主机节点信息。


server {        listen       80;        server_name  df.php.com;    #主机名        #charset koi8-r;        #access_log  logs/host.access.log  main;        root   "F:\phpStudy\WWW\df.php.com";   #目录index  index.php index.html index.htm;        #error_page  404              /404.html;        # redirect server error pages to the static page /50x.html        #        error_page   500 502 503 504  /50x.html;        location = /50x.html {            root   html;        }        # proxy the PHP scripts to Apache listening on 127.0.0.1:80        #        #location ~ \.php$ {        #    proxy_pass   http://127.0.0.1;        #}        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000        #        location ~ \.php(.*)$  {            fastcgi_pass   127.0.0.1:9000;            fastcgi_index  index.php;            fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;            fastcgi_param  PATH_INFO  $fastcgi_path_info;            fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;            include        fastcgi_params;        }        # deny access to .htaccess files, if Apache's document root        # concurs with nginx's one        #        #location ~ /\.ht {        #    deny  all;        #}    }


0 0
原创粉丝点击