Implementation steps:
1. Create a folder and upload pictures
2. Check the nginx process
ps -ef | grep nginx
3. Modify nginx configuration file
Check the nginx installation directory according to step 2; (usually the nginx installation directory is cd /usr/local/nginx/)
If the installation directory is customized, it depends on the actual situation.
Enter the nginx installation directory:
1、cd /usr/local/nginx/
2、cd conf
3、vim nginx.conf
4. Add image configuration and save
Add location location /img/ { alias /img/; autoindex on; } to the server . Parsing:#img is the directory where images are stored on the server. It is dynamically adjusted according to the level of the folder you create (the example only creates img).
#autoindex meaning: Automatically create an index on or offOverall example:
5. Restart nginx
./nginx -s reload
6. Introduction to instructions
Enter nginx:
cd /usr/local/nginx/sbin #Adjust the
restart nginx command according to the actual directory address of the individual: ./nginx -s reload
stop nginx command: ./nginx -s stop
7. Visit
http://server ip address+nginx configured port number/img/zhifeiji1.png
example:http://127.0.0.1:8080/img/zhifeiji1.png