Does the content system listen to port 8001 by default, and should it be changed when deploying reverse proxy?
The content system listens on port 8001 by default, should it be changed when the reverse proxy goes online? The conclusion is to decide according to the access path, not by habit. When there is a reverse proxy in front, there is no need to change the program port to 80 or 443, keep it as 8001 for clarity: the proxy is responsible for external protocols and certificates, and the program is responsible for the application itself. The place that needs to be changed is in the proxy configuration and site address settings, pointing the forwarding target to the local 8001, and ensuring that 8001 is not directly accessible on the public network. When there is no proxy in front, it is necessary to handle standard ports at the entry layer.
Why is it recommended to keep the program port?
There are two practical benefits to retaining the original port. One is that the configuration does not change during upgrades and rollbacks; when deploying Docker images, the port mapping is written in the orchestration, and changing the program to listen on the port will also change the mapping and health checks. The other is that troubleshooting is clear, and it is easy to distinguish between the proxy layer and the application layer when problems occur. AnQiCMS supports deployment with Baota panel, aaPanel, LNMP command deployment, and Docker image in several ways, and the default port is 8001. It is more in line with the layered habit to entrust the proxy to the entry layer in all paths.
Three items to be changed on the proxy side
The first item is the forwarding target and protocol, forwarding the domain name resolution to port 80 and 443 to the local application port, and terminating the certificate at the proxy layer. The second item is the site access address setting, the site address in the background should be written as the external domain name instead of the address with the application port, otherwise the generated links, image paths, and push addresses will all include the port number. The third item is the transmission of real visitor information, passing the visitor address and protocol header to the application to avoid the proxy address being all in the log, and to prevent data collection and access statistics from obtaining incorrect sources.
Should the port be open to the outside?
This is the real security issue with this configuration. The application port should only listen internally, and only the standard port used by the proxy should be opened on the public side. After going online, try accessing the address with the application port directly from the outside once, and if it can be opened, it means the boundary has not been tightened, and the public entry of this port should be turned off in the firewall or security group. The same is true for the background entry, and the management path should also be confirmed to ensure that it has not been exposed directly without going through the proxy.
How to check static resources and pseudo-static resources
The most common two types of exceptions after modifying the proxy are image path and address redirection. Static resources need to be confirmed to use the external domain name, and the path should remain consistent after backup and recovery; the pseudo-static rules should align with the rewrite order of the proxy layer to avoid the situation where the application has generated a friendly address and the proxy handles it according to another set of rules. Check the order first: open the homepage to see if all resource requests fall under the domain name, then verify the category pages, detail pages, sitemap, and search pages one by one, and finally confirm that the 301 redirect of the old address still works in the proxy layer.
The verification list on the day of launch
Go through five items: External direct access to the application port should not be accessible; Domain name access through proxy is normal and the address does not include a port; Backend login and form submissions for comments and reviews are normal; Sitemap and robots file are accessible; After completing one backup and recovery exercise, confirm that static files are also included in the backup range. Only after all five items pass should traffic be released.
Common questions
Question: Will changing the port affect search engine crawling?Answer: The crawling sees the external domain name and path, as long as the site address is configured correctly and the page links do not include an internal port, it will not affect. On the contrary, including the application port in the link is more likely to cause address inconsistency.
How do I also use the standard port for local debugging?Similarly, add a layer of proxy or use port mapping locally, keep the application port unchanged, and avoid forming two sets of habits between debugging and production configurations.
Can multiple sites share the same application port?You need to distinguish whether it is multiple sites under the same instance or multiple independent instances. In the multi-site scenario, distribution should be done according to the domain name at the entry layer, and independent instances should occupy their respective application ports and be distributed by a proxy.