微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

nginx.conf配置格式

80端口:

server
    {

        listen 80;
        #listen [::]:80;
        server_name 域名 ;
        index index.html index.htm index.PHP default.html default.htm default.PHP;
        root   /home/wwwroot/aaa;

        include none.conf;
        #error_page   404   /404.html;

        # Deny access to PHP files in specific directory
        #location ~ /(wp-content|uploads|wp-includes|images)/.*\.PHP$ { deny all; }

        include enable-PHP.conf;

           location / {
             if ( !-e $request_filename ) {
             rewrite ^(.*)$ /index.PHP?s=/$1 last;
             break;
           }
          }

        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }

        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }

        location ~ /.well-kNown {
            allow all;
        }

        location ~ /\.
        {
            deny all;
        }
                 access_log  /home/wwwlogs/日志.log;
    }

1111:端口

    server
    {

        listen 1111;
        #listen [::]:80;
        server_name 域名 ;
        index index.html index.htm index.PHP default.html default.htm default.PHP;
        root   /home/wwwroot/aaa;

        include none.conf;
        #error_page   404   /404.html;

        # Deny access to PHP files in specific directory
        #location ~ /(wp-content|uploads|wp-includes|images)/.*\.PHP$ { deny all; }

        include enable-PHP.conf;

           location / {
             if ( !-e $request_filename ) {
             rewrite ^(.*)$ /index.PHP?s=/$1 last;
             break;
           }
          }

        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }

        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }

        location ~ /.well-kNown {
            allow all;
        }

        location ~ /\.
        {
            deny all;
        }
                access_log  /home/wwwlogs/日志.log;
    }

443端口(https):

server {
        listen 443;
        server_name xsgcweb.iffmd.cn; #填写绑定证书的域名
        ssl on;
        ssl_certificate 1_***_bundle.crt;
        ssl_certificate_key 2_***.key;
        ssl_session_timeout 5m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #按照这个协议配置
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;#按照这个套件配置
        ssl_prefer_server_ciphers on;

        index index.html index.htm index.PHP default.html default.htm default.PHP;
        root  /home/wwwroot/aaa;

        #include none.conf;
        #error_page   404   /404.html;

        # Deny access to PHP files in specific directory
        #location ~ /(wp-content|uploads|wp-includes|images)/.*\.PHP$ { deny all; }

        include enable-PHP-pathinfo.conf;
        location /public/ {
                if (!-e $request_filename){
                    rewrite  ^/public/(.*)$  /public/index.PHP?s=$1  last;
                }
            }

        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }

        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }

        location ~ /.well-kNown {
            allow all;
        }

        location ~ /\.
        {
            deny all;
        }
             access_log  /home/wwwlogs/日志.log;
    }

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐