Lnmp使用laravel报500,网上的方法都无法解决
下面是我的网站配置:
server
    {
        listen 80;
        #listen [::]:80;
        server_name www.bumoe.com bumoe.com;
        index index.html index.htm index.php default.html default.htm default.php;
        root  /home/wwwroot/bumoe/laravel/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;
        }
        access_log  /home/wwwlogs/www.bumoe.com.log;
    }
server
    {
        listen 443 ssl http2;
        #listen [::]:443 ssl http2;
        server_name www.bumoe.com bumoe.com;
        index index.html index.htm index.php default.html default.htm default.php;
        root  /home/wwwroot/bumoe/laravel/public;
        ssl on;
        ssl_certificate /usr/local/nginx/conf/ssl/www.bumoe.com.crt;
        ssl_certificate_key /usr/local/nginx/conf/ssl/www.bumoe.com.key;
        ssl_session_timeout 5m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;
        ssl_ciphers "EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";
        ssl_session_cache builtin:1000 shared:SSL:10m;
        # openssl dhparam -out /usr/local/nginx/conf/ssl/dhparam.pem 2048
        ssl_dhparam /usr/local/nginx/conf/ssl/dhparam.pem;
        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;
        }
        access_log  /home/wwwlogs/www.bumoe.com.log;
    }
请问是我配置文件哪里没修改嘛?
1.stroage和cache文件夹已经改成777
2.在网站根目录建一个index.php里面写上内容,在把root指向到这个文件就可以访问。但是把root指向到public就报500错误。。。。
                                                            
            
2 Comments
报错:
Warning: require(): open_basedir restriction in effect. File(/home/wwwroot/bumoe/laravel/vendor/autoload.php) is not within the allowed path(s): (/home/wwwroot/bumoe/laravel/public/:/tmp/:/proc/) in /home/wwwroot/bumoe/laravel/public/index.php on line 24
Warning: require(/home/wwwroot/bumoe/laravel/vendor/autoload.php): failed to open stream: Operation not permitted in /home/wwwroot/bumoe/laravel/public/index.php on line 24
Fatal error: require(): Failed opening required '/home/wwwroot/bumoe/laravel/public/../vendor/autoload.php' (include_path='.:/usr/local/php/lib/php') in /home/wwwroot/bumoe/laravel/public/index.php on line 24
已经解决!
注释掉/usr/local/nginx/conf/fastcgi.conf最后一行的:
#fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/";
就OK了,不过我这里注释掉后又遇到了权限问题,给storage目录重新 chmod 777 -R storage了一下