Taking Windows as an example, Linux is actually the same; Build a static resource server There are many pictures under the work folder on my computer. I want to build a static resource server through nginx and complete the directory mapping by entering the ip+port in the address bar. Find the nginx installation directory, open the /conf/nginx.conf configuration file, and add a virtual host Add listening port and access domain name The key is to add location. Mapping-URL: /work/; Note: If there is already a location in the current server module and the URL is "/", then the URL of the newly created location should be the matching path and cannot be "/". At this time, the mapping path cannot be written casually. First, there must be this URL directory under your root directory, otherwise it will report 404 (this rule hurt me at the time); If not, the URL can be written as "/", as shown below: Add the root directory (the root directory where you want to display static resources, use forward slashes "/") between levels): D:/pic_resource/; Enable browsing directory permission: autoinedx on, the default is off; Then save and start nginx; Nginx command under Windows: First, enter the nginx directory in cmd command mode, Start: start nginx.exe; Load the latest configuration: ./nginx.exe -s reload; Stop: ./nginx.exe -s quit; If you want to check whether it has been started, you can check whether there is an nginx.pid file in the logs file in the nginx directory. If there is, it means it has been started successfully. If there is no error, you can check the error.log in the logs directory, which will remind you where the error occurred. Enter 127.0.0.1:8008/work/ in the address bar, and you will see the following picture, indicating that the configuration is successful. This is the end of this article about the steps to use nginx to build a static resource server. For more relevant nginx static resource server content, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Method example of safely getting deep objects of Object in Js
>>: Summary of common knowledge points required for MySQL
Basic introduction to robots.txt Robots.txt is a p...
Table of contents Written in front Solution 1: Us...
Declare the parameter name, type and permission y...
background go-fastdfs is a distributed file syste...
background There is a requirement in the project ...
In the process of Django web development, when wr...
In fact, we wonder every day when IE6 will really...
Today, I set up a newly purchased Alibaba Cloud E...
Table of contents 1. Introduction to grub.cfg fil...
When any project develops to a certain complexity...
Table of contents 1. Cross-domain filter CorsFilt...
This article mainly introduces an example of Vue ...
<br />This is from the content of Web front-...
Table of contents aforementioned VARCHAR Type VAR...
deepin and Ubuntu are both distributions based on...