一:登陆域名服务器平台,把域名解析到项目对应的IP上面。
二:配置nginx服务器
1./etc/nginx/conf.d/ 在服务器该目录下,添加.conf文件,如命名为:www.demo.com.conf
server {
listen ;
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=$ last;
rewrite ^/(.*)$ /index.php/$ last;
break;
}
} error_page /.html;
location = /.html {
root /data/www/demo;
} error_page /50x.html;
location = /50x.html {
root /data/www/demo;
} location ~ \.php {
root /data/www/demo; fastcgi_pass 127.0.0.1:; fastcgi_index index.php; include fastcgi.conf; set $real_script_name $fastcgi_script_name; if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") { set $real_script_name $; set $path_info $; } 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(修改配置后重新加载生效 )