nginx部署
CentOS 7安装nginx, sudo yum install nginx
设置开机自启
sudo systemctl start nginx
sudo systemctl enable nginx
访问主机的ip, 或者域名
编辑sudo vim /etc/nginx/nginx.conf, 在http中的{}中添加:
server {
listen 80;
server_name ip或域名;
root path;
location /{
autoindex on;
autoindex_exact_size off; #显示文件的大小
autoindex_localtime on; #显示文件时间
#limit_rate_after 5m; #5分钟后下载速度限制为200k
limit_rate 200k;
}
access_log logs/pypi.log main;
}
修改user xxx为path文件夹的用户和组名user name group.
使用sudo nginx -t查看配置文件是否正确
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful