昨天发了一个aria2的安装教程,有伙伴咨询我说nginx怎么配置,今天特意写出昨天指导小伙伴nginx的详细配置供大家参考。
安装nginx,请移步《环境搭建篇》
创建aria2.conf文件,yum安装的nginx在/etc/nginx,而其他安装方式请自行按照安装的位置配置。
vi
/etc/nginx/conf.d/aria2.conf
server {
server_name aria.rednn.cn; //
配置一个域名,如果是本地的配置,需要改成localhost;并添加一个端口
root /opt/aria2; //
aria2的部署目录位置
location / {
root /opt/aria2;
index index.php index.html index.htm;
try_files $uri $uri/ /index.php$is_args$args;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
include /etc/nginx/default.d/*.conf; //
这里引用的是php环境变量
location ~ /\.ht {
deny all;
}
}
重启nginx
systemctl restart nginx
访问http://127.0.0.1或者访问http://ip:端口。
至此配置完成,如果还有哪里不明白的可以留言!
微信扫描下方的二维码阅读本文