nginx http https 配置案例

linux nginx 配置

server{
        listen 80;
        server_name www.worldsipo.com;
        index index.html index.htm index.php;
        root  /home/wwwroot/default/*****/public;

        #error_page   404   /404.html;
        #include enable-php.conf;
        include enable-php-pathinfo.conf;
        location /nginx_status
        {
            stub_status on;
            access_log   off;
        }
        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }

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

        location ~ /\.
        {
            deny all;
        }

        access_log  /home/wwwlogs/access-jiuling.log;
}

server{
    #listen 80;
    listen 443 ssl;
    server_name www.worldsipo.com;
    index index.htm index.php admin.php;
    try_files $uri $uri/ /index.html;
    root  /home/wwwroot/default/*****/public;
    ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
    ssl_certificate worldsipo.com_chain.crt;
    ssl_certificate_key worldsipo.com_key.key;
    ssl_prefer_server_ciphers on;

	add_header Last-Modified $date_gmt;
    add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
    if_modified_since off;
    expires off;
    etag off;

    #error_page   404   /404.html;
    include enable-php-pathinfo.conf;
	
	location ^~ /admin.php {
        #allow 218.93.209.11;
	    #deny all;
        fastcgi_pass  unix:/tmp/php-cgi.sock;
	    #fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi.conf;
        include pathinfo.conf;
	}
	
    location /nginx_status
    {
        stub_status on;
        access_log   off;
    }

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

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

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

    location ~ /\.
    {
        deny all;
    }

    access_log  /home/wwwlogs/access-jiuling.log;
}

posted @   盘思动  阅读(139)  评论(0编辑  收藏  举报
编辑推荐:
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)
历史上的今天:
2019-02-23 无限级树状图css实现
2019-02-23 无限级别分类嵌套格式抓取
点击右上角即可分享
微信分享提示