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

