全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 1818|回复: 7

[nginx] NGINX双站配置??高手进

[复制链接]
发表于 2010-4-10 11:54:54 | 显示全部楼层 |阅读模式
NGINX原来配置了一个站点在跑,现在想在VPS里多装一个站,这是我原来的配置,我把service那一段拷贝一次,改了鱼名,文件夹之类的,但重启失败...我现在的新文件夹在/html/ssh, 新域名:www.sshintelligence.com 高手进来帮忙小改一下配置,先谢过

#######################################################################
#
# This is the main Nginx configuration file.  
#
# More information about the configuration options is available on
#   * the English wiki - http://wiki.codemongers.com/Main
#   * the Russian documentation - http://sysoev.ru/nginx/
#
#######################################################################

#----------------------------------------------------------------------
# Main Module - directives that cover basic functionality
#
#   http://wiki.codemongers.com/NginxMainModule
#
#----------------------------------------------------------------------

user              nginx;
worker_processes  4;

error_log         /var/log/nginx/error.log;
#error_log        /var/log/nginx/error.log  notice;
#error_log        /var/log/nginx/error.log  info;

pid               /var/run/nginx.pid;



#----------------------------------------------------------------------
# Events Module
#
#   http://wiki.codemongers.com/NginxEventsModule
#
#----------------------------------------------------------------------

events {
    worker_connections  1024;
}


#----------------------------------------------------------------------
# HTTP Core Module
#
#   http://wiki.codemongers.com/NginxHttpCoreModule
#
#----------------------------------------------------------------------

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] $request '
                      '"$status" $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    gzip  on;
   
    # Load config files from the /etc/nginx/conf.d directory
    include /etc/nginx/conf.d/*.conf;

    #
    # The default server
    #
    server {
        listen       80;
        server_name  www.myhost.com myhost.com;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   /usr/share/nginx/html/magento;
            index  index.php index.html index.htm;
            rewrite ^(/index.php)?/minify/([^/]+)(/.*.(js|css))$ /lib/minify/m.php?f=$3&d=$2 last;
            if (-f $request_filename) {
                   expires 30d;
                   break;
            }
            if (!-e $request_filename) {
                   rewrite ^(.+)$ /index.php last;
            
                                                }
        }

        error_page  404              /404.html;
        location = /404.html {
            root   /usr/share/nginx/html/magento;
        }

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html/magento;
        }

        # 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_param  SCRIPT_NAME $fastcgi_script_name;
            fastcgi_param  SCRIPT_FILENAME  /usr/share/nginx/html/magento$fastcgi_script_name;
            include        fastcgi_params;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }
}
发表于 2010-4-10 12:17:05 | 显示全部楼层
1. server段复制,不是service
2. server段下指定不同的root
3. 更换配置文件重启nginx前先测试配置文件正确与否
命令:/usr/local/nginx/sbin/nginx -t
 楼主| 发表于 2010-4-10 12:18:31 | 显示全部楼层

好马上试试谢谢

好马上试试谢谢
 楼主| 发表于 2010-4-10 12:26:31 | 显示全部楼层
2010/04/10 08:23:04 [warn] 15696#0: conflicting server name "www.sshintelligence.com" on 0.0.0.0:80, ignored
2010/04/10 08:23:04 [info] 15696#0: the configuration file /etc/nginx/nginx.conf syntax is ok
2010/04/10 08:23:04 [info] 15696#0: the configuration file /etc/nginx/nginx.conf was tested successfully

测试结果没过,具体配置已PM,麻烦帮忙看看
 楼主| 发表于 2010-4-10 12:43:54 | 显示全部楼层

回复 2# 的帖子

我已经更改了所有的ROOT路径呀.
 楼主| 发表于 2010-4-10 14:02:58 | 显示全部楼层
顶上去,顶到高手来
发表于 2010-4-10 14:05:25 | 显示全部楼层

回复 4# 的帖子

15696#0: conflicting server name "www.sshintelligence.com" on 0.0.0.0:80, ignored
 楼主| 发表于 2010-4-10 16:26:38 | 显示全部楼层
哈哈,低级错误
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-4-29 20:21 , Processed in 0.077765 second(s), 8 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表