1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

How to Deploy Angular or React SSR and WordPress headless Admin (Backend Only) on the same...

Discussão em 'Angular' iniciado por Mohamed Sabry, Maio 26, 2025.

  1. I have an Angular Universal app (Node.js, SSR) running on port 80 (http://<my-ip>/) and a WordPress site on port 8080 (http://<my-ip>:8080/) using Apache. I want to:

    1. Serve both on port 80, so http://<my-ip>/ loads Angular, and http://<my-ip>/wp-admin or /backend loads WordPress admin.
    2. Disable WordPress front-end (e.g., homepage, blog posts) and keep only the backend (/wp-admin, /backend).
    3. Ensure Angular's sitemap and robots.txt are served correctly without interference from WordPress.

    Currently, WordPress serves both front-end and admin on port 8080, and Angular runs on port 80. I tried setting up a reverse proxy in my Node.js server (server.mjs) to forward /wp-admin and /backend to port 8080, but I need help configuring Apache to disable the WordPress front-end and ensuring the setup works smoothly on port 80.

    Here's my Apache config (/etc/apache2/sites-available/000-default.conf):

    <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>


    Angular runs via a systemd service (angular-app.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


    WordPress files (e.g., wp-admin, wp-content, index.php) are in /var/www/backend, and Angular files (e.g., server/, browser/, package.json) are in /var/www/html.

    1. How can I configure Apache to disable WordPress front-end and allow only /wp-admin and /backend?
    2. Is my Node.js reverse proxy setup optimal for serving both apps on port 80?
    3. How do I ensure Angular's sitemap and robots.txt are served correctly and WordPress admin URLs are not indexed by search engines?

    Environment:


    • OS: Ubuntu 22.04


    • Angular: Universal 19 SSR


    • Database: MySQL 8.0

    Continue reading...

Compartilhe esta Página