600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > Linux-CentOS 7 nginx静态资源服务器简单配置

Linux-CentOS 7 nginx静态资源服务器简单配置

时间:2020-06-10 07:32:27

相关推荐

Linux-CentOS 7 nginx静态资源服务器简单配置

nginx静态资源服务器简单配置

在nginx的server中可以拥有多个location,但location 后面那部分不能一样。

进入nginx安装目录的conf目录下,修改nginx.conf文件,在一个server{}中添加 一个location 部分配置代码如下

root@ubuntu:/usr/local/nginx/conf# vi nginx.confserver {listen 80;server_name localhost;location / {root html;index index.html index.htm;}location /image/ {root /usr/local/myImage/; <--代表 image之前的目录autoindex on;}}

刷新nginx的配置,重启即可

root@ubuntu:/usr/local/nginx/sbin# ./nginx -s reloadroot@ubuntu:/usr/local/nginx/sbin#

严禁直接搬运。标明出处。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。