Home >Operation and Maintenance >Nginx >How to solve the image access 404 problem after Nginx image server configuration

How to solve the image access 404 problem after Nginx image server configuration

WBOY
WBOYforward
2023-05-19 11:22:064135browse

My wrong configuration is:

How to solve the image access 404 problem after Nginx image server configuration

Server file root address:

How to solve the image access 404 problem after Nginx image server configuration

I want to enter this through the browser The image is accessed at the address:

How to solve the image access 404 problem after Nginx image server configuration

However, you will find that the file cannot be found and it will always 404. The reason is that the root path configuration is wrong. Let’s take a look at the principle of the root path:

## The #root configuration means that the URL will be followed by the directory configured by root to form the corresponding file path.

means that the address we enter in the browser actually accesses

/home/ftpuser/images/images/~~~

The /images behind our location will be spelled to the actual access path.

There are two processing methods:

1. The processing method is to remove the images behind root. As follows:

How to solve the image access 404 problem after Nginx image server configuration

#In this way, you can access the image by entering the address before entering it in the browser~~~~~~~~~~~~~~~~~

2. The second solution is to use alias to configure the access path

How to solve the image access 404 problem after Nginx image server configuration

The above is the detailed content of How to solve the image access 404 problem after Nginx image server configuration. For more information, please follow other related articles on the PHP Chinese website!

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