nginx 新增域名访问

时间:2023-03-09 13:42:21
nginx 新增域名访问

nginx 新增域名访问

1.申请阿里云域名

2.指向阿里云主机

3.配置nginx文件

server {
listen 80;
server_name zlx.test.com;
set $root_path /web/;
location / {
root $root_path;
index index.html index.htm index.php;
if (!-e $request_filename) {
# rewrite ^(.*)$ /index.php?s=/$1 last;
rewrite ^/index.php(.*)$ /index.php?s=$1 last;
rewrite ^(.*)$ /index.php?s=$1 last; }
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root $root_path;
}

最后测试访问。

zlx.test.com