安装wnmp环境及多站点配置

wnmp(windows+Nginx+MariaDB+php)

git地址  官网

组件版本
Nginx 1.5.13
MariaDB 10.0.10
PHP 5.5.11 (Non Thread Safe + FastCGI)
phpMyAdmin 4.1.12
下载安装exe(安装过程略)

我是安装在 D:\Wnmp
安装好之后是如下界面
wnmp

数据库 用户:root 密码:password

Nginx多站点配置

1.修改 D:\Wnmp\conf\nginx.conf 在http中加入
# Add Vhost
include vhost/*.conf;

2.在D:\Wnmp\conf 目录下新建 vhost目录

3.在D:\Wnmp\conf\vhost 目录下新建 test.conf文件 内容参考如下

server {
    listen 80;
    server_name test.dev www.test.dev;

    access_log  logs/access_test.log;

    root html/test/public;
    index index.html index.htm index.php;
    charset utf-8; 
    #rewrite index
    location / {
        try_files $uri $uri/ /index.php?$args;
    }
    
    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    location ~ /\.ht {
        deny  all;
    }
}

5.修改host
127.0.0.1 test.dev

6.新建D:\Wnmp\html\test\public\index.php

7.重启nginx,在浏览器中输入http://test.dev 即可看到上步中 index的内容

Comments are closed.