- polar2010-07-12金牌会员1157
nginx下添加域名是不是有两种方式
1 直接运行 ./vhost.sh
2- 修改/usr/local/nginx/conf/nginx.conf 文件
- - 在
- - server
- - {
- - listen 80;
- - server_name status.lnmp.org;
- - location / {
- - stub_status on;
- - access_log off;
- - }
- - }
- - 后面添加上下面代码:
- - server
- - {
- - listen 80;
- - server_name www.abc.com
- ;
- - index index.html index.htm index.php;
- - root /home/wwwroot/abc;
- - location ~ .*\.(php|php5)?$
- - {
- - fastcgi_pass unix:/tmp/php-cgi.sock;
- - #fastcgi_pass 127.0.0.1:9000;
- - fastcgi_index index.php;
- - include fcgi.conf;
- - }
- - location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
- - {
- - expires 30d;
- - }
- - location ~ .*\.(js|css)?$
- - {
- - expires 12h;
- - }
- - access_log off;
- - }
- - 再执行kill -HUP
cat /usr/local/nginx/logs/nginx.pid虚拟机就生效了。复制代码我用./vhost.sh 添加 了一个域名 和目录后 显示
3163
不知道这样的目录正确不正确.
然后在***.com 里放了一个网页文件 ,访问 显示 403 Forbidden.
有熟练nginx的朋友麻烦讲解一下, 添加多网站目录,多域名的步骤.