Created
November 22, 2019 07:25
-
-
Save qlong8807/16a99916fe87b8af1b72dab609ae8963 to your computer and use it in GitHub Desktop.
nginx发布静态页面,nginx做图片服务器 配置。一个文件中可以写多个server。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 8081; | |
server_name 10.255.203.162; | |
#charset koi8-r; | |
#access_log logs/host.access.log main; | |
location / { | |
root C:\Users\zyl\Documents\Axure\HTML; | |
try_files $uri $uri/ @router; | |
index index.html start.html; | |
} | |
location @router { | |
rewrite ^.*$ /index.html last; | |
} | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
root html; | |
} | |
} | |
server { | |
listen 80; | |
server_name localhost; | |
#charset koi8-r; | |
#access_log logs/host.access.log main; | |
location ~ \.(gif|jpg|jpeg|png|bmp|swf)$ { | |
#把图片放到该路径下,访问http://localhost/1.png即可。 | |
root E:/tools/imageserver/www; | |
} | |
location / { | |
root html; | |
index index.html index.htm; | |
} | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
root html; | |
} | |
} | |
修改完成后,用nginx -t验证配置文件,使用nginx -s reload重新加载配置文件。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment