Table of Contents
Ubuntu system Nginx deploys ThinkPHP 6 project, 8088 port 404 error check
Problem description
Nginx configuration file
Solution
Home Backend Development PHP Tutorial How to fix 404 errors encountered when deploying a ThinkPHP 6 project on port 8088 via Nginx on Ubuntu?

How to fix 404 errors encountered when deploying a ThinkPHP 6 project on port 8088 via Nginx on Ubuntu?

Apr 01, 2025 pm 12:33 PM
thinkphp php7 nginx operating system system version

How to fix 404 errors encountered when deploying a ThinkPHP 6 project on port 8088 via Nginx on Ubuntu?

Ubuntu system Nginx deploys ThinkPHP 6 project, 8088 port 404 error check

When deploying PHP projects using Nginx on Ubuntu, especially when listening for non-standard ports (such as 8088), you often encounter 404 errors. This article will analyze in detail the 404 problems encountered when deploying ThinkPHP 6 projects on port 8088 through Nginx on Ubuntu and provide solutions.

Problem description

On Ubuntu systems, using Nginx to deploy ThinkPHP 6 project to port 8088, accessing any interface or files under public directory will return a 404 error. The Alibaba Cloud Security Group has released port 8088.

Nginx configuration file

Configuration file under conf.d (xxx.conf):

 server {
    listen 8088;
    server_name your server IP address; # Please replace it with your server IP

    root /path/to/your/project/public; # Please replace it with your project's public directory path index index.php index.html index.htm;

    location / {
        try_files $uri $uri/ /index.php?$args; # simplify try_files directive}

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; # Please check whether the php-fpm socket path is correct fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # Use the standard parameter name include fastcgi_params;
    }
}
Copy after login

nginx.conf file (some key configurations):

 user www-data;
worker_processes auto;
# ... other configurations ...
include /etc/nginx/conf.d/*.conf;
# ... other configurations ...
Copy after login

Solution

  1. Configuration file syntax check: Use nginx -t xxx.conf to check configuration file syntax errors. If there is any error, modify and re-run the command. Then execute systemctl reload nginx or service nginx reload to restart the Nginx service.

  2. Local testing: Use curl 127.0.0.1:8088 on the server to test whether it is accessible. If you can access it, it means that the Nginx configuration is basically correct, and the problem may be in the external network configuration of the server or the firewall.

  3. Network configuration and firewall:

    • Firewall: Confirm whether Ubuntu firewall (such as UFW) allows access to port 8088. You can use sudo ufw allow 8088 to allow access, and then sudo ufw status to view the status.
    • Alibaba Cloud Security Group: Check the Alibaba Cloud Security Group rules carefully again to ensure that the entry direction rules for port 8088 are correctly configured and allow your client IP address to access.
  4. php-fpm socket path: Ensure that the /var/run/php/php7.4-fpm.sock path is correct and is consistent with the configuration of php-fpm. Check whether the php-fpm service is running normally.

  5. Permissions issue: Check whether the Nginx user (www-data) has read execution permissions for the project directory and its files.

  6. ThinkPHP 6 routing configuration: Check whether the routing configuration of the ThinkPHP 6 project is correct to ensure that the request can be processed correctly.

  7. Log check: Check Nginx error log /var/log/nginx/error.log nginx/error.log to see if there is more detailed error information.

If the above steps still fail to resolve the problem, please provide the following information for further troubleshooting:

  • Server operating system version
  • Nginx version
  • PHP version
  • php-fpm configuration
  • ThinkPHP version 6
  • Complete Nginx error log content

By systematically examining each of the above aspects, you should be able to find and resolve the root cause of the 404 error.

The above is the detailed content of How to fix 404 errors encountered when deploying a ThinkPHP 6 project on port 8088 via Nginx on Ubuntu?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1662
14
PHP Tutorial
1262
29
C# Tutorial
1235
24
What is the main purpose of Linux? What is the main purpose of Linux? Apr 16, 2025 am 12:19 AM

The main uses of Linux include: 1. Server operating system, 2. Embedded system, 3. Desktop operating system, 4. Development and testing environment. Linux excels in these areas, providing stability, security and efficient development tools.

Is the vscode extension malicious? Is the vscode extension malicious? Apr 15, 2025 pm 07:57 PM

VS Code extensions pose malicious risks, such as hiding malicious code, exploiting vulnerabilities, and masturbating as legitimate extensions. Methods to identify malicious extensions include: checking publishers, reading comments, checking code, and installing with caution. Security measures also include: security awareness, good habits, regular updates and antivirus software.

The difference between laravel and thinkphp The difference between laravel and thinkphp Apr 18, 2025 pm 01:09 PM

Laravel and ThinkPHP are both popular PHP frameworks and have their own advantages and disadvantages in development. This article will compare the two in depth, highlighting their architecture, features, and performance differences to help developers make informed choices based on their specific project needs.

How to run sublime after writing the code How to run sublime after writing the code Apr 16, 2025 am 08:51 AM

There are six ways to run code in Sublime: through hotkeys, menus, build systems, command lines, set default build systems, and custom build commands, and run individual files/projects by right-clicking on projects/files. The build system availability depends on the installation of Sublime Text.

git software installation git software installation Apr 17, 2025 am 11:57 AM

Installing Git software includes the following steps: Download the installation package and run the installation package to verify the installation configuration Git installation Git Bash (Windows only)

Can vscode compare two files Can vscode compare two files Apr 15, 2025 pm 08:15 PM

Yes, VS Code supports file comparison, providing multiple methods, including using context menus, shortcut keys, and support for advanced operations such as comparing different branches or remote files.

How to set important Git configuration global properties How to set important Git configuration global properties Apr 17, 2025 pm 12:21 PM

There are many ways to customize a development environment, but the global Git configuration file is one that is most likely to be used for custom settings such as usernames, emails, preferred text editors, and remote branches. Here are the key things you need to know about global Git configuration files.

Can vs code compile c Can vs code compile c Apr 15, 2025 pm 08:12 PM

VS Code can be used to compile C, and it has high efficiency and good debugging experience, thanks to its rich expansion ecosystem. The specific steps include: installing the C compiler (such as GCC, Clang). Install the C/C extension. Compile C code using a built-in terminal or build system such as CMake. Use the debugger to debug code. Improve development efficiency with code snippets and custom tasks.

See all articles