I have a domain name, assuming it is "example.com". The backend nginx has already proxy a tomcat. The proxy domain name is "http://www.example.com/", which will jump to the tomcat service. This is normal at present.
Now I want to add another php service, on the same server, using the same nginx proxy, the url path is "http://www.example.com/php", and access the php code under /data/wwwroot/php .
However, when accessing "http://www.example.com/php", the tomcat service that will be forwarded will prompt "HTTP status 404 - Not Found", and the suffix shows that it is the "Apache Tomcat service".
So I suspect that the proxy is not effective. When I change the domain name of the php proxy to another one, such as php.example.com, the proxy is successful, but I don't want to encounter cross-domain problems. Please tell me how to set up php
This is the configuration of nginx proxy tomcat
server { listen 80; server_name www.example.com; location / { proxy_pass http://localhost:8080; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE-HOST $remote_addr; add_header X-Cache $upstream_cache_status; proxy_set_header X-Host $host:$server_port; proxy_set_header X-Scheme $scheme; proxy_connect_timeout 30s; proxy_read_timeout 86400s; proxy_send_timeout 30s; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } } This is the configuration of nginx proxy php. This is not normal.
server { listen 80; server_name www.example.com; location /php { try_files $uri $uri/ /index.php$is_args$args; alias /data/wwwroot/php; index index.php index.htm index.html; location ~ \.php$ { try_files $uri =404; fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } } How should I solve this problem?