我在Centos 6-LEMP Stack的PHP 7.2版本上运行Laravel,当我配置domain.conf,nginx.conf(如Apache中的.htaccess)时出现错误,我不知道如何解决它,所以我上传了我的2个文件配置,希望这里有人可以帮我检查一下,非常感谢! 我正在使用:Centos 6-PHP 7.2-LEMP堆栈(Nginx-MariaDB-PHP-FPM),Laravel
server {
listen 80;
server_name www.example.com example.com;
rewrite ^(.*) https://example.com$1 permanent;
include /etc/nginx/conf.d/php.conf;
include /etc/nginx/conf.d/staticfiles.conf;
include /etc/nginx/conf.d/block.conf;
include /home/nginx/example.com/public_html/nginx.conf;
}
server {
server_name www.example.com example.com;
listen 443 ssl default_server;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
error_log /home/nginx/example.com/log/error.log error;
root /home/nginx/example.com/public_html/public;
index index.php index.html index.htm;
try_files $uri $uri/ /index.php$is_args$args;
# SSL
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
# Improve HTTPS performance with session resumption
ssl_session_cache shared:SSL:50m;
ssl_session_timeout 1d;
# DH parameters
ssl_dhparam /etc/nginx/ssl/dhparam.pem;
# Enable HSTS
add_header Strict-Transport-Security "max-age=31536000" always;
location / {
#try_files $uri $uri/ /index.php?$args;
#root /home/nginx/example.com/public_html/public;
#index index.php index.html index.htm;
#try_files $uri $uri/ /index.php$is_args$args;
}
# Remove trailing slash to please routing system.
if (!-d $request_filename) {
rewrite ^/(.+)/$ /$1 permanent;
}
#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 /usr/share/nginx/html;
}
# Custom configuration
include /home/nginx/example.com/public_html/*.conf;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_connect_timeout 1000;
fastcgi_send_timeout 1000;
fastcgi_read_timeout 1000;
fastcgi_buffer_size 256k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;
fastcgi_param SCRIPT_FILENAME /home/nginx/example.com/public_html$fastcgi_script_name;
}
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
location /php_status {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/nginx/example.com/public_html$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
allow 127.0.0.1;
deny all;
}
# Disable .htaccess and other hidden files
location ~ /\.(?!well-known).* {
deny all;
access_log off;
log_not_found off;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~* \.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso|eot|svg|ttf|woff)$ {
gzip_static off;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
access_log off;
expires 30d;
break;
}
location ~* \.(txt|js|css)$ {
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
access_log off;
expires 30d;
break;
}
}
它显示一个错误 Error
请帮助我修复它,非常感谢!