Ubuntu16.04使用apt安装完nginx常见问题

1、安装完并remove掉后重新install后没nginx.conf文件

解决办法:

apt-get -y --purge remove nginx*

apt-get -y autoremove

apt -y install nginx

 

2、搭建文件服务器:

apt -y install nginx                                   #安装

cp /etc/nginx/nginx.conf{,.bak}                #备份主配置文件

vim /etc/nginx/conf.d/file.conf                 #配置配置文件

server {
listen 80; # 监听端口
server_name 192.168.1.101;     # 自己PC的ip或者服务器的域名
charset utf-8;     # 避免中文乱码
root /var/www/html;     # 文件路径
location / {
autoindex on;     # 索引
autoindex_exact_size on;     # 显示文件大小
autoindex_localtime on;        # 显示文件时间
     }
}

service nginx reload              #重新载入

 

posted @ 2019-08-24 11:46  e-8bit  阅读(1073)  评论(0编辑  收藏  举报