[摘要]这篇文章主要介绍了详解nginx配置访问图片路径以及html静态页面的调取方法,现在分享给大家,也给大家做个参考。给大家讲一个快速配置nginx访问图片地址,以及访问html静态页面的配置。1.实验...
这篇文章主要介绍了详解nginx配置访问图片路径以及html静态页面的调取方法,现在分享给大家,也给大家做个参考。
给大家讲一个快速配置nginx访问图片地址,以及访问html静态页面的配置。
1.实验环境
首先随便某个路径下创建相应的目录。如图下

2.在里面放自定义的html或者图片。
3.nginx配置
user root;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;#端口号
server_name localhost;#本机
charset utf-8;
#access_log logs/host.access.log main;
location ~ .*\.(gif
关键词:nginx设置访问图片路径以及html静态页面的调取办法