lnmp环境下TP框架的项目nginx配置文件的设置

发布时间:2020-07-28 15:48:10 作者:phpervip
来源:网络 阅读:1242

开发时用的apache服務器。TP框架。

lnmp服务器(lnmp.org):
lnmp add后自动生成的配置文件为:

server
{
listen 80;
#listen [::]:80;
server_name ---.----.--;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/----/public;

    include none.conf;
    #error_page   404   /404.html;
    include enable-php.conf;

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

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

    location ~ /\.
    {
        deny all;
    }

    access_log off;
}

~
~
~
~
~
这样的话
本地,---.----.--/admin能够打开,
服务器上 ---.----.--/admin 就报nginx 的 404错误了!404 Not Found

增加后面几行。
修改后,再lnmp restart.
就好了!

[root@hkdata02 vhost]# vi ---.----.--.conf

    #listen [::]:80;
    server_name ---.----.--;
    index index.html index.htm index.php default.html default.htm default.php;
    root  /home/wwwroot/---/public;

    #include other.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 ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
        expires      30d;
    }

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

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

    location ~ /\.
    {
        deny all;
    }
    if ( !-e $request_filename) {
        rewrite ^(.*)$ /index.php?s=$1 last;
        break;
    }
    access_log  /home/wwwlogs/---.----.--.log;
}
推荐阅读:
  1. redis环境下mysql是如何实现lnmp架构缓存的
  2. LNMP(nginx php-fpm mysql) 环境部署——mysql

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

php thinkphp 环境下

上一篇:JavaScript布尔运算符的用法

下一篇:ES5模拟ES6的Symbol如何实现私有成员功能

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》