nginx 配置多站點 nginx.conf 主配置文件裏 include /usr/local/nginx/conf/vhost/*.conf
各個站點 配置文件 都放在vhost目錄下並以.conf後綴
例:
server{
listen 80;
server_name 你的項目名;
root 你的項目目錄;
index index.PHP index.html;
location / {
try_files $uri/ /index.php?$args;
}
location ~ .*\.(php)?${
expires 1s;
try_files $uri = 404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 你的端口地址;
}
access_log logs/你的項目名_access.log access;
error_log logs/你的項目名_error.log;
}