1
我有以下配置在端口80上偵聽,但重定向到https。然後,通過index.php文件路由一切,但是,當我去一個頁面時,它只是下載index.php文件或在主頁上顯示403 forbidden
。nGinx和PHP-FPM下載index.php
任何想法?
server {
listen 80;
server_name www.mydomain.com mydomain.com;
rewrite^https://$server_name$request_uri? permanent;
}
server {
listen 443;
server_name www.mydomain.com;
root /var/www/mydomain/public;
ssl on;
ssl_certificate mydomain.crt;
ssl_certificate_key mydomain.key;
ssl_session_timeout 5m;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
ssl_prefer_server_ciphers on;
location/{
if (!-e $request_filename){
rewrite \.(jpeg|jpg|gif|png)$ /public/404.php break;
}
if (!-e $request_filename){
rewrite ^(.*)$ /index.php break;
}
}
location ~ \.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index /index.php;
include /etc/nginx/fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
root /var/www/mydomain/public;
}
location ~ /\.ht {
deny all;
}
}
服務關閉127.0.0.1:9000的文件是什麼? – Michael
也嘗試刪除'fastcgi_index/index.php'中的''' – Michael