配置Nginx的配置文件server {
root /home/user/www/项目名称;
index index-test.php index.php index.html index.htm;
server_name 项目域名;
location / {
try_files $uri $uri/ /index.php?$args; #注意这个地方入口文件是index-test.php就写index-test.php
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 24h;
log_not_found off;
}
# Block for processing PHP files
# Specifically matches URIs ending in .php
location ~ \.php$ {
try_files $uri =404;
# Fix for server variables that behave differently under nginx/php-fpm than typically expected
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# Include the standard fastcgi_params file included with nginx
include fastcgi_params;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_index index.php;
# Override the SCRIPT_FILENAME variable set by fastcgi_params
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# Pass to upstream PHP-FPM; This must match whatever you name your upstream connection
# for debug need long time
send_timeout 600;
fastcgi_read_timeout 600;
fastcgi_send_timeout 600;
fastcgi_pass 127.0.0.1:9000;
}
}
vim /etc/hosts文件,把你的域名解析到你自己的机器,一般是加入(127.0.0.0你的域名)