1. 程式人生 > >nginx兩個域名指向一個專案的解決辦法

nginx兩個域名指向一個專案的解決辦法

域名伺服器跳轉

server
{
    listen       80;
    server_name  www.xxx.com;
    index index.html index.htm index.php;
    root  /data/www/b2b2c/public;
    if ($host !~* www\.(.*))
    {
        rewrite ^/(.*)$ http://www.xxx.com/$1 permanent;
    }

    location ~ \.git {
        return 500;
    }

    location / {
        if
(!-e $request_filename) { rewrite ^/(.*)$ /index.php/$1 last; } } location ~ ^/shopadmin { rewrite ^/(.*)$ /index.php/$1 last; } location ~ .*\.php.* { include php_fcgi.conf; include pathinfo.conf; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30
d; } location ~ .*\.(js|css)?$ { expires 1h; } access_log /data/logs/nginx/access.log; #access_log off; }