nginx建立虚拟目录的配置文件放在/etc/nginx/conf.d目录下。系统用的是CentOS6.3。
首先在nginx.conf中查找有没有:
添加虚拟目录
我们把这两个虚拟目录写在一个配置文件里。 server { listen 80; server_name blog.aaa.com; access_log /var/log/nginx/blog.aaa.log main; location / { root /home/blog.aaa; index index.php index.html index.htm; } location ~ \.php$ { root /home/blog.aaa; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /home/blog.aaa$fastcgi_script_name; include fastcgi_params; } } server { listen 80; server_name bbs.bbb.com; access_log /var/log/nginx/bbs.bbb.log main; location / { root /home/bbs.bbb; index index.php index.html index.htm; } location ~ \.php$ { root /home/bbs.bbb; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /home/bbs.bbb$fastcgi_script_name; include fastcgi_params; } }
更新nginx配置: |