laraveladmin安装后无法访问到,需要在nginx中添加这样一行

Laravel框架
428
0
0
2022-05-23

添加location / { try_files $uri $uri/ /index.php?$query_string; }

完整config文件内容如下

server {
    listen 80;
    server_name XXXX.cn;
    rewrite ^(.*)$ https://$host$1 permanent;
}
server {
    listen 443 ssl;
    server_name XXXX.cn;
    root "/var/www/XXXX/public"; 
    index index.html index.htm index.php;
    charset utf-8;

       ssl_certificate  cert/5740548_XXXX.pem;
       ssl_certificate_key cert/5740548_XXXX.key;        
       ssl_session_timeout 5m;
       ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
       ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
       ssl_prefer_server_ciphers on;

    access_log /var/log/nginx/XXXX.log;
    error_log /var/log/nginx/XXXX-error.log error;

    sendfile off;

    client_max_body_size 100m;

location / {
    try_files $uri $uri/ /index.php?$query_string;
}

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        fastcgi_param DOCUMENT_ROOT $realpath_root;

        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
        fastcgi_connect_timeout 300;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;}

    location ~ /\.ht {
        deny all;}
}