一:登陆域名服务器平台,把域名解析到项目对应的IP上面。
二:配置nginx服务器
1./etc/nginx/conf.d/ 在服务器该目录下,添加.conf文件,如命名为:www.demo.com.conf
server { listen 80; server_name www.demo.com; location / { root /data/www/demo; index index.html index.htm index.php; if (!-e $request_filename) { #rewrite ^(.*)$ /index.php?s=$1 last; rewrite ^/(.*)$ /index.php/$1 last; break; } } error_page 404 /404.html; location = /404.html { root /data/www/demo; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /data/www/demo; } location ~ .php { root /data/www/demo; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi.conf; set $real_script_name $fastcgi_script_name; if ($fastcgi_script_name ~ "^(.+?.php)(/.+)$") { set $real_script_name $1; set $path_info $2; } fastcgi_param SCRIPT_FILENAME $document_root$real_script_name; fastcgi_param SCRIPT_NAME $real_script_name; fastcgi_param PATH_INFO $path_info; } }
2: 重启nginx服务器
使用Xshell等远程登陆工具,执行:nginx -s reload(修改配置后重新加载生效 )