laraveladmin安裝後無法訪問到,需要在nginx中新增這樣一行

宋高峰發表於2021-07-16

新增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;
    }
}
本作品採用《CC 協議》,轉載必須註明作者和本文連結

相關文章