您的位置:首页 > 运维架构 > Nginx

简单实用nginx 配置 本机 虚拟主机 windows 下的。

2014-09-18 16:25 656 查看
这里的前提是配置的 安装好的nginx 已经能够正常使用以及 php能够正常解析

打开 nginx 目录下的 conf 文件夹

打开 nginx.conf 文件

将下列的文字复制一遍,大约是conf文件的  88行开始

    #server {

    #    listen       8000;

    #    listen       somename:8080;

    #    server_name  somename  alias  another.alias;

    #    location / {

    #        root   html;

    #        index  index.html index.htm index.php;

    #    }

    #}

然后去掉前面的 # 号

然后复制自己配置好 php 的那一段,将地址改成自己域名对应的文件夹

    server {

        listen       80;

        server_name  d.ms.cn;  //自己本机解析配置的域名(在hosts 里改的)

        location / {

            root D:/wamp/www/z/;

            index  index.html index.htm index.php;

        }

        location ~ \.php$ {

            root           D:/wamp/www/z/;

            fastcgi_pass   127.0.0.1:9000;

            fastcgi_index  index.php;

            include        fastcgi_params;

            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

            

        }

    }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息