search
HomeOperation and MaintenanceNginxnginx can start successfully but cannot be accessed

nginx can start successfully but cannot be accessed

Environment

Alibaba Cloud Server Ubuntu 16.04.3 LTS

I made a demo for learning and built vue elementui spring boot with front-end and back-end separation . Deploy the project to the server. After installing nginx, in order to avoid conflicts, I changed the port to 8001, started nginx, and found that I could not access it!

(Recommended tutorial: nginx tutorial)

Find the problem

1. First check whether the nginx configuration is correct

nginx -t   #查看nginx配置是否正确  也可以切换到nginx的安装目录下的sbin目录下,执行: ./nginx -t

2. Check whether nginx starts successfully.

ps -ef | grep nginx  #查看nginx端口

After execution, it is found that there is no problem with the nginx configuration and the startup is successful! Then, I had a hunch that the port was not open because I was using an Alibaba Cloud server and needed to configure a security group first.

3. Configure the Alibaba Cloud security group, that is, open the corresponding port so that other hosts can access the port 8001 I configured in

nginx can start successfully but cannot be accessed

nginx, so Open the ports in the 8000-9000 range here. But the access still doesn't work. It should be that the server itself has not opened port 8001.

4. Check whether the port corresponding to the server is open

(1) Check whether the firewall is open

sudo ufw status   # 如果输出:Status: inactive 说明防火墙已经关闭,按理说端口应该都是开放的,用自己的主机连接远程服务器都是可以的

You can turn off the firewall, open all ports, and execute the following command

ufw disable   #关闭防火墙
ufw enable  # 开启防火墙

(2) If the firewall is turned on for security reasons, you can open a certain port separately

Check whether the port is open

telnet ip port  # telnet 59.110.155.32 8001

I tested it on the Alibaba Cloud server, and the result As follows:

nginx can start successfully but cannot be accessed

The above picture shows that port 8001 is not released and port 8080 is released;

ps:

View all open ports

Command 1

netstat -a # 查看所有服务端口

Command 2

nmap + ip地址 # 如:nmap 127.0.0.1

Many times telnet cannot be exited, and ctrl c sometimes cannot exit;

This First execute: ctrl ] and then enter quit on the telnet command line to exit.

Open the port so that other hosts can access it.

If all of the above are successful, you must be able to access it!

The above is the detailed content of nginx can start successfully but cannot be accessed. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:csdn. If there is any infringement, please contact admin@php.cn delete
Nginx SSL/TLS Configuration: Securing Your Website with HTTPSNginx SSL/TLS Configuration: Securing Your Website with HTTPSApr 10, 2025 am 09:38 AM

To ensure website security through Nginx, the following steps are required: 1. Create a basic configuration, specify the SSL certificate and private key; 2. Optimize the configuration, enable HTTP/2 and OCSPStapling; 3. Debug common errors, such as certificate path and encryption suite issues; 4. Application performance optimization suggestions, such as using Let'sEncrypt and session multiplexing.

Nginx Interview Questions: Ace Your DevOps/System Admin InterviewNginx Interview Questions: Ace Your DevOps/System Admin InterviewApr 09, 2025 am 12:14 AM

Nginx is a high-performance HTTP and reverse proxy server that is good at handling high concurrent connections. 1) Basic configuration: listen to the port and provide static file services. 2) Advanced configuration: implement reverse proxy and load balancing. 3) Debugging skills: Check the error log and test the configuration file. 4) Performance optimization: Enable Gzip compression and adjust cache policies.

Nginx Caching Techniques: Improving Website PerformanceNginx Caching Techniques: Improving Website PerformanceApr 08, 2025 am 12:18 AM

Nginx cache can significantly improve website performance through the following steps: 1) Define the cache area and set the cache path; 2) Configure the cache validity period; 3) Set different cache policies according to different content; 4) Optimize cache storage and load balancing; 5) Monitor and debug cache effects. Through these methods, Nginx cache can reduce back-end server pressure, improve response speed and user experience.

Nginx with Docker: Deploying and Scaling Containerized ApplicationsNginx with Docker: Deploying and Scaling Containerized ApplicationsApr 07, 2025 am 12:08 AM

Using DockerCompose can simplify the deployment and management of Nginx, and scaling through DockerSwarm or Kubernetes is a common practice. 1) Use DockerCompose to define and run Nginx containers, 2) implement cluster management and automatic scaling through DockerSwarm or Kubernetes.

Advanced Nginx Configuration: Mastering Server Blocks & Reverse ProxyAdvanced Nginx Configuration: Mastering Server Blocks & Reverse ProxyApr 06, 2025 am 12:05 AM

The advanced configuration of Nginx can be implemented through server blocks and reverse proxy: 1. Server blocks allow multiple websites to be run in one instance, each block is configured independently. 2. The reverse proxy forwards the request to the backend server to realize load balancing and cache acceleration.

Nginx Performance Tuning: Optimizing for Speed and Low LatencyNginx Performance Tuning: Optimizing for Speed and Low LatencyApr 05, 2025 am 12:08 AM

Nginx performance tuning can be achieved by adjusting the number of worker processes, connection pool size, enabling Gzip compression and HTTP/2 protocols, and using cache and load balancing. 1. Adjust the number of worker processes and connection pool size: worker_processesauto; events{worker_connections1024;}. 2. Enable Gzip compression and HTTP/2 protocol: http{gzipon;server{listen443sslhttp2;}}. 3. Use cache optimization: http{proxy_cache_path/path/to/cachelevels=1:2k

Nginx Security Hardening: Protecting Your Web Server From AttacksNginx Security Hardening: Protecting Your Web Server From AttacksApr 04, 2025 am 12:06 AM

Nginx security enhancement can be achieved through the following steps: 1) Ensure all traffic is transmitted through HTTPS, 2) Configure HTTP headers to enhance communication security, 3) Set up SSL/TLS encrypted data transmission, 4) Implement access control and rate limiting to prevent malicious traffic, 5) Use the ngx_http_secure_link_module module to prevent SQL injection attacks. These measures can effectively improve the security of Nginx servers.

Nginx Load Balancing: Configuring for High Availability and ScalabilityNginx Load Balancing: Configuring for High Availability and ScalabilityApr 03, 2025 am 12:12 AM

Nginx can achieve high availability and scalability by configuring load balancing. 1) Define upstream server groups, 2) Select appropriate load balancing algorithms such as polling, weighted polling, minimum connection or IP hashing, 3) Optimize configuration and monitor and adjust server weights to ensure optimal performance and stability.

See all articles

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use