In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "nginx how to configure the access picture path and html static page call", in the daily operation, I believe that many people have doubts on how to configure the access picture path and html static page call in nginx. Xiaobian consulted all kinds of information and sorted out a simple and easy-to-use method of operation. I hope it will be helpful for you to answer the question of "how to configure the access picture path and html static page call". Next, please follow the editor to study!
1. Experimental environment
First of all, create the corresponding directory under any path. As shown in the picture
two。 Put custom html or pictures in it.
3.nginx configuration
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 80th # port number server_name localhost;# native charset utf-8; # access_log logs/host.access.log main; location ~. *\. (gif | jpg | jpeg | png) ${expires 24h; root / home/images/;# specifies the image storage path access_log / usr/local/websrv/nginx-1.9.4/logs/images.log # Log storage path proxy_store on; proxy_store_access user:rw group:rw all:rw; proxy_temp_path / home/images/;# image access path proxy_redirect off; proxy_set_header host 127.0.0.1; client_max_body_size 10m; client_body_buffer_size 1280k; proxy_connect_timeout 900 Proxy_send_timeout 900; proxy_read_timeout 900; proxy_buffer_size 40k; proxy_buffers 40 320k; proxy_busy_buffers_size 640k; proxy_temp_file_write_size 640k; if (!-e $request_filename) {proxy_pass http://127.0.0.1; # default port 80}} location / {root / home/html; # html access path index index.html index2.htm; # html file name} error_page 404 / 404.html
4. Check to see if there is an error in the compilation, and if there is no error, the setting is successful.
5. If you visit nginx, you can access the address of the image you visit.
6. When accessing a custom html.
At this point, the study on "how to configure the access image path and html static page access by nginx" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.