Nginx tp3.2.3 404 problem solution

Nginx tp3.2.3 404 problem solution

Recently I changed Apache to nginx. When I moved the TP project to run, I found a 404 error. It turned out that this was because nginx did not support pathinfo mode and needed to be configured by myself.

Below I configure

In the server configuration

location / {
    #root html
    index index.html index.htm index.php ;
    if (!-e $request_filename) { 
    rewrite ^/test/tp/(.*)$ /test/tp/index.php/$1 last;
    break; 
}     
location ~ \.php { #Note that this must be the same, no $
  set $script $uri;
  set $path_info "/";
  if ($uri ~ "^(.+\.php)(/.+)") {
    set $script $1;
    set $path_info $2;
  }
  fastcgi_pass 127.0.0.1:9000;
  fastcgi_index index.php?IF_REWRITE=1;
  include fastcgi_params;
  fastcgi_param PATH_INFO $path_info;
  fastcgi_param SCRIPT_FILENAME $document_root/$script;
  fastcgi_param SCRIPT_NAME $script;
}

After saving the configuration, restart nginx and the configuration is successful

Directly supports pseudo-static mode like /Index.html

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Solution to the problem of refreshing page 404 using nginx under vue
  • Several ways to implement 404 pages in Nginx (three types)
  • The nginx reverse proxy service causes a 404 error when accessing resources due to an error in the configuration file
  • How to configure NGINX server to redirect 404 error page
  • Solution to the 404 issue when directly entering the routing path after configuring the React project URL in Nginx
  • Summary of Nginx's method of implementing 404 pages
  • Solution to 404 error in PHP (FastCGI) under Nginx alias
  • A murder caused by an equal sign (talking about the correct 404 configuration of Nginx)
  • The correct way to define a 404 page and return a 404 status code in Nginx
  • How to configure 404 error page under NGINX

<<:  Front-end state management (Part 2)

>>:  HTML table markup tutorial (18): table header

Recommend

Summary of MySQL string interception related functions

This article introduces MySQL string interception...

html opens a new window with a hyperlink and can control window properties

1. The window size opened by the HTML hyperlink C...

Implementation of element multiple form validation

In the project, form testing is often encountered...

Detailed explanation of the installation and use of Vue-Router

Table of contents Install Basic configuration of ...

Solution to Incorrect string value in MySQL

Many friends will report the following error when...

Detailed explanation of the use of Linux seq command

01. Command Overview The seq command is used to g...

On Visual Design and Interaction Design

<br />In the entire product design process, ...

mysql5.7.18 decompressed version to start mysql service

The decompressed version of mysql5.7.18 starts th...

Summary of MySQL InnoDB architecture

Table of contents introduction 1. Overall archite...

What are inline elements and block elements?

1. Inline elements only occupy the width of the co...

How to make form input and other text boxes read-only and non-editable in HTML

Sometimes, we want the text boxes in the form to b...

MySQL operations: JSON data type operations

In the previous article, we introduced the detail...

How to install and deploy ftp image server in linux

Refer to the tutorial on setting up FTP server in...