Nginx部署星益小游戏平台(静态页面)
1. 星益小游戏平台部署
源码下载:https://c1026.dmpdmp.com/e01306e2fdcd92aac114784572ec6e20/68a424b6/2019/08/17/f1aac2083a4d2e76196e57e68aed173f.zip?fn=%E6%98%9F%E7%9B%8A%E5%B0%8F%E6%B8%B8%E6%88%8F%E5%B9%B3%E5%8F%B0.zip
服务器目录准备:
$ 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
