Nginx部署星益小游戏平台(静态页面)
1. 星益小游戏平台部署
服务器目录准备:
$ mkdir -p /usr/share/nginx/game
文件星益小游戏平台.zip上传到 /usr/share/nginx/game 目录下:
$ cd /usr/share/nginx/game
$ unzip 星益小游戏平台.zip
$ rm -f 星益小游戏平台.zip
准备配置文件:
$ cp /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/game.conf
$ sudo tee /etc/nginx/conf.d/game.conf > /dev/null << 'EOF'
server {
listen 81;
server_name www.game.com;
location / {
root /usr/share/nginx/game;
index index.html;
}
}
EOF
本地主机映射配置:
-
Windows 系统修改:
C:\Windows\System32\drivers\etc\hosts文件 -
Mac 系统修改:
/etc/hosts文件
新增:
# 10.0.0.12 是部署 Nginx 的服务器的 IP
10.0.0.12 www.game.com
重启 Nginx 服务:
$ nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
$ systemctl restart nginx.service
网页访问:http://www.game.com:81

浙公网安备 33010602011771号