美文网首页
配置nginx静态文件服务器

配置nginx静态文件服务器

作者: 扳手扳死你 | 来源:发表于2017-05-16 14:36 被阅读0次

1.安装nginx
sudo apt-get install nginx

2.配置
安装完成后默认目录为/usr/share/nginx/html
配置文件/etc/nginx/sites-available/default
将配置修改为如下
server_name localhost;

location / {

# First attempt to serve request as file, then

# as directory, then fall back to displaying a 404.

root /usr/share/nginx/html/;

autoindex on;

}

3.删除/usr/share/nginx/html 中默认的index.html

4重启nginx
sudo service nginx restart

相关文章

网友评论

      本文标题:配置nginx静态文件服务器

      本文链接:https://www.haomeiwen.com/subject/nuslxxtx.html