CentOS Laravel 配置了nginx root running时报错

Warning: include(/home/www/station/vendor/composer/../symfony/http-kernel/HttpKernelInterface.php): failed to open stream: No such file or directory in /home/www/station/vendor/composer/ClassLoader.php on line 444

Warning: include(): Failed opening '/home/www/station/vendor/composer/../symfony/http-kernel/HttpKernelInterface.php' for inclusion (include_path='.:/usr/local/php/lib/php') in /home/www/station/vendor/composer/ClassLoader.php on line 444

Fatal error: Interface 'Symfony\Component\HttpKernel\HttpKernelInterface' not found in /home/www/station/vendor/laravel/framework/src/Illuminate/Foundation/Application.php on line 25

nginx配置如下:

server {
        listen       80;
        server_name  localhost;

        charset UTF-8;
        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   /home/www/station/public/;
            index  index.html index.htm index.php;
        try_files $uri $uri/ /index.php?$query_string;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /home/www;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
                root            /home/www/station/public/;
                fastcgi_pass    127.0.0.1:9000;
                fastcgi_index   index.php;
                fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include         fastcgi_params;
        }
阅读 2.3k
1 个回答
server {  
        listen  80;    
        server_name localhost;    
        set $root_path '/data/appname/public';    
        root $root_path;    
        
        index index.php index.html index.htm;    
        
        try_files $uri $uri/ @rewrite;    
        
        location @rewrite {    
            rewrite ^/(.*)$ /index.php?_url=/$1;    
        }    
        
        location ~ \.php {    
        
            fastcgi_pass 127.0.0.1:9000;    
            fastcgi_index /index.php;    
        
            fastcgi_split_path_info       ^(.+\.php)(/.+)$;    
            fastcgi_param PATH_INFO       $fastcgi_path_info;    
            fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;    
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;    
            include                       fastcgi_params;  
        }    
        
        location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {    
            root $root_path;    
        }    
        
        location ~ /\.ht {    
            deny all;    
        }    
    }

使用这个配置,保证PHP-FPM 已经启动

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题