欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

一个ok的 nginx.conf 的虚拟主机的配置 www.aaaaa.com.conf 有大用 有大大用 有大大大用

server {


        listen       80;


        server_name  www.aaaaa.com aaaaa.com  www.bbbbb.cn_bak2 bbbbb.cn_bak2 xbbbbb.com www.xbbbbb.com www.ccccc.com ccccc.com www.ddddd.com ddddd.com eeeee.com www.eeeee.com xccccc.com www.xccccc.com fffff.com www.fffff.com zs.aaaaa.com;


        root /home/wwwroot/www_aaaaa_com/public_html;


        if ($host = 'zs.aaaaa.com'){


            rewrite ^.*$ https://aisite.ggggg.com/site/wjzcbdww/43fd4b96-d3aa-4320-b634-4620f018b42a permanent;


        }


        set $flag 0;


        if ($host = 'www.xbbbbb.com'){


            set $flag "${flag}1";


        }


        if ($http_user_agent ~* "android|blackberry|googlebot-mobile|iemobile|iphone|ipod|opera mobile|palmos|webos"){


            set $flag "${flag}2";


            # rewrite ^.*$  http://3g.aaaaa.com permanent;


        }


        if ($flag = "012"){


             rewrite ^.*$  http://3g.xbbbbb.com permanent;


        }


        if ($flag = "02") {


            rewrite ^.*$  http://3g.aaaaa.com permanent;


        }


        index  index.html index.php index.htm;


        error_page  400 /errpage/400.html;


        error_page  403 /errpage/403.html;


        error_page  404 /errpage/404.html;


        location ~ \.php$ {


                proxy_pass http://127.0.0.1:88;


                include naproxy.conf;


        }


        location / {


                try_files $uri @apache;


        }


     location @apache {


                 proxy_pass http://127.0.0.1:88;


                 include naproxy.conf;


        }


}




server {


        listen       443;


        root /home/wwwroot/www_aaaaa_com/public_html;


        ssl                  on;


        ssl_certificate      cert/ccccc.com.pem;


        ssl_certificate_key  cert/ccccc.com.key;


        ssl_prefer_server_ciphers on;


        ssl_session_timeout 10m;


        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;


        ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;


        server_name ccccc.com www.ccccc.com;


        if ($http_user_agent ~* "android|blackberry|googlebot-mobile|iemobile|iphone|ipod|opera mobile|palmos|webos"){


             rewrite ^.*$  http://3g.aaaaa.com permanent;


        }


        index  index.html index.php index.htm;


        error_page  400 /errpage/400.html;


        error_page  403 /errpage/403.html;


        error_page  404 /errpage/404.html;


        error_page  503 /errpage/503.html;


        location ~ \.php$ {


                proxy_pass http://127.0.0.1:88;


                include naproxy.conf;


        }


location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {


                expires      1d;


        }


        location ~ .*\.(js|css|htm)?$ {


                expires      12h;


        }


        location ~ /\.ht {


                    deny  all;


            }


        location / {


                try_files $uri @apache;


        }


       location @apache {


                 internal;


                 proxy_pass http://127.0.0.1:88;


                 include naproxy.conf;


        }


}


server {


        listen       443;


        root /home/wwwroot/www_aaaaa_com/public_html;


        ssl                  on;


        ssl_certificate      cert/aaaaa.com.pem;


        ssl_certificate_key  cert/aaaaa.com.key;


        ssl_prefer_server_ciphers on;


        ssl_session_timeout 10m;


        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;


        ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;


        server_name aaaaa.com www.aaaaa.com;


        if ($http_user_agent ~* "android|blackberry|googlebot-mobile|iemobile|iphone|ipod|opera mobile|palmos|webos"){


             rewrite ^.*$  http://3g.aaaaa.com permanent;


        }


        index  index.html index.php index.htm;


        error_page  400 /errpage/400.html;


        error_page  403 /errpage/403.html;


        error_page  404 /errpage/404.html;


        error_page  503 /errpage/503.html;


        location ~ \.php$ {


                proxy_pass http://127.0.0.1:88;


                include naproxy.conf;


        }


        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {


                expires      1d;


        }


        location ~ .*\.(js|css|htm)?$ {


                expires      12h;


        }


        location ~ /\.ht {


                    deny  all;


            }


    location / {


                try_files $uri @apache;


        }


       location @apache {


                 internal;


                 proxy_pass http://127.0.0.1:88;


                 include naproxy.conf;


        }


}




普通分类: