I’m working on my Angular Universal application using Node.js with server-side rendering on port 80, while my WordPress site operates on port 8080 through Apache. I need to make both applications accessible on port 80. Specifically, I want to:
- Serve Angular when visiting
http://my-ip/ - Access WordPress admin at
http://my-ip/wp-adminor/backend - Disable all front-end functionality of WordPress, keeping only the admin interfaces available at
/wp-adminand/backend - Ensure that Angular’s sitemap and robots.txt are unaffected by WordPress settings
Currently, my WordPress setup serves both the front-end and admin on port 8080, while Angular is on port 80. I attempted to implement a reverse proxy within my Node.js server configuration to redirect requests to /wp-admin and /backend on port 8080, but I’m unsure about how to configure Apache to turn off the WordPress front-end while ensuring everything functions correctly on port 80.
Here’s my Apache configuration for reference:
<VirtualHost *:8080>
ServerName my-ip
DocumentRoot /var/www/backend
<Directory /var/www/backend>
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<FilesMatch "^.">
Require all denied
</FilesMatch>
ErrorLog ${APACHE_LOG_DIR}/backend_error.log
CustomLog ${APACHE_LOG_DIR}/backend_access.log combined
</VirtualHost>
And here’s how I’m running my Angular app with a systemd service:
[Unit]
Description=Angular SSR Application
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=/var/www/html
ExecStart=/usr/bin/node server/server.mjs
Restart=always
Environment=NODE_ENV=production
Environment=PORT=80
[Install]
WantedBy=multi-user.target
Finally, the WordPress and Angular files are located in the following directories:
- WordPress files (e.g.,
wp-admin,wp-content,index.php) are at/var/www/backend - Angular files (e.g.,
server/,browser/,package.json) are at/var/www/html
I have a few questions:
- How can I configure Apache to ensure only
/wp-adminand/backendare accessible while blocking the WordPress front-end? - Is my current setup for the Node.js reverse proxy the best method to serve both applications on port 80?
- How can I make sure that Angular’s SEO directives, like sitemap and robots.txt, work correctly and that WordPress admin URLs do not get indexed by search engines?
System environment details:
- OS: Ubuntu 22.04
- Angular: Universal 19 SSR
- Database: MySQL 8.0