关于nginx
1.先行安装nginx
2.上传网页到服务器
上传文件可以使用scp,lrzsz命令等上传上去
假定文件在/home/ubuntu/digst
3.修改nginx配置文件
vi /etc/nginx/sites-available/default
找到下面这一段
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
修改为:
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
#try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
index index.html;
root /home/ubuntu;
}
保存后退出
然后重新加载nginx的配置文件
nginx -s reload
或者 service nginx restart
最后打开浏览器,输入 http://服务器ip即可访问挂载的网页内容
评论区