600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > nginx作为静态资源服务器的配置

nginx作为静态资源服务器的配置

时间:2021-04-09 20:23:58

相关推荐

nginx作为静态资源服务器的配置

在http模块添加:

server {

listen 80;

server_name localhost;

location /www/ {

root /data/;

index index.html index.htm;

}

location /image/ {

root /data/;

autoindex on;

}

}

创建目录,拷贝文件

mkdir -p /data/www

mkdir /data/image

cp yellow.jpg /data/image

cp index.html /data/www

nginx -s reload

浏览器访问:

http://localhost/www/index.html

http://localhost/image/yellow.jpg

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