停止并禁用防火墙
systemctl stop firewalld.service #停止firewalldsystemctl disable firewalld.service #禁用firewalld
关闭SElinux功能
setenforce 0 # 临时关闭SElinuxgetenforce # 查看SElinux状态#修改配置文件使其永远生效sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
编辑配置文件:vim /etc/nginx/conf.d/default.conf
location /download { alias /home/software/; #指定目录所在路径,注意alias和后面的/ autoindex on; #开启目录浏览 autoindex_format html; #以html风格将目录展示在浏览器中 autoindex_exact_size off; #切换为 off 后,以可读的方式显示文件大小,单位为 KB、MB 或者 GB autoindex_localtime on; #以服务器的文件时间作为显示的时间 charset "utf-8,gbk"; #展示中文文件名 }
相关命令
#启动nginx服务systemctl start nginx.service #设置开机自启动systemctl enable nginx.service#停止开机自启动systemctl disable nginx.service#查看服务当前状态systemctl status nginx.service#重新启动服务systemctl restart nginx.service #查看所有已启动的服务systemctl list-units --type=service