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
Open the folder C:\web\mysql-8.0.11 that you just...
Vue3 project encapsulation side navigation text s...
Before reading this article, I hope you have a ba...
Table of contents Preface 1. Set the prototype on...
npm uninstall sudo npm uninstall npm -g If you en...
Preface What is data type conversion? The default...
Table of contents text LOCK parameter ALGORITHM p...
Table of contents Constructing payment methods us...
Some time ago, the blogger installed the Ubuntu s...
Table of contents Skeleton screen use Vue archite...
1. Introduction to mysqldump mysqldump is a logic...
Table of contents Preface Modifiers of v-model: l...
1. Install Fcitx input framework Related dependen...
1. What is MySQL master-slave synchronization? Wh...
The following content introduces the process and ...