Home  >  Article  >  Operation and Maintenance  >  How to solve the problem that nginx static website does not display images

How to solve the problem that nginx static website does not display images

王林
王林forward
2020-09-01 16:35:025586browse

How to solve the problem that nginx static website does not display images

First we need to master the following commands:

(Recommended tutorial: nginx tutorial)

start nginx                      //运行
nginxnginx -s stop          // 停止nginx
nginx -s reload       // 重新加载配置文件(如修改配置文件后,可通过该命令重新加载)
nginx -s quit          // 退出nginx
nginx -v                 //可查nginx版本

Then / Modify the nginx.conf file in the usr/local/nginx/conf directory and add this paragraph:

location ~* ^.+\.(jpg|jpeg|gif|png|bmp)$ {
        access_log off;
        root html;
        expires 30d;        break;
        }

Here you need to write the website directory behind the root correctly

Finally, you need to correct the picture Authorize the folders and pictures and give all users viewing permissions:

chmod 774 ./images

Finally use the above command to reload the configuration:

nginx -s reload

The above is the detailed content of How to solve the problem that nginx static website does not display images. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete