nginx伪静态https配置

发布时间:2014-07-21 19:00:00 阅读:979次
server {
        listen 80;
        server_name www.phpjx.com;
server_tokens off;
root    /var/www/html/phpjx;
autoindex off;
access_log /var/www/html/phpjx/logs/access.log;
error_log /var/www/html/phpjx/logs/error.log;

location / {
allow 180.97.80.102;
allow 127.0.0.1;
allow 58.39.194.158;
allow 116.226.46.24;
deny all;
root /var/www/html/phpjx;
index  index.html index.php index.htm;
#rewrite ^/(\w+)/(.*)$ /$1/index.php last;
rewrite ^/index.html$ /index.php last;
rewrite ^/product.html$ /index.php?c=index&m=show&classid=2 last;
rewrite ^/product_(\d*).html$ /index.php?c=index&m=show&classid=2&id=$1 last;
rewrite ^/hr.html$ /index.php?c=index&m=show&classid=5 last;
rewrite ^/hr_(\d*).html$ /index.php?c=index&m=show&classid=5&id=$1 last;
rewrite ^/aboutus.html$ /index.php?c=index&m=show&classid=4 last;
rewrite ^/news.html$ /index.php?c=index&m=show&classid=3 last;
rewrite ^/news_(\d*).html$ /index.php?c=index&m=show&classid=3&id=$1 last;
rewrite ^/contactus.html$ /index.php?c=index&m=show&classid=6 last;
}
error_page 404 /404.html;
location = /404.html {
root /var/www/html/phpjx;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

        location ~ \.php$ {
            root           /var/www/html/phpjx;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }

         location ~ /\. {
                 deny all;
                 log_not_found off;
                 access_log off;
         }

         location ~ \.log$ {
deny all;
                log_not_found off;
                access_log off;
         }

}

server {
        listen 443;
        server_name www.phpjx.com;
server_tokens off;
root    /var/www/html/phpjx/Upload;
ssl on;
ssl_certificate    server.crt;  #证书
ssl_certificate_key  server.key; #私钥
autoindex off;
access_log /var/www/html/phpjx/Upload/logs/access.log;
error_log /var/www/html/phpjx/Upload/logs/error.log;

location / {
root /var/www/html/phpjx/Upload;
index  index.html index.php index.htm;
}
error_page 404 /404.html;
location = /404.html {
root /var/www/html/phpjx/Upload;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

        location ~ \.php$ {
            root           /var/www/html/phpjx/Upload;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }

         location ~ /\. {
                 deny all;
                 log_not_found off;
                 access_log off;
         }

         location ~ \.log$ {
                deny all;
                log_not_found off;
                access_log off;
         }

}

如有问题,可以QQ搜索群1028468525加入群聊,欢迎一起研究技术

支付宝 微信

有疑问联系站长,请联系QQ:QQ咨询
上一篇:php文件操作
下一篇:shell执行php

转载请注明:nginx伪静态https配置 出自老鄢博客 | 欢迎分享