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              #重新载入

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM