Question

Running Java+Angular app and wordpress on same droplet and same domain

Posted April 7, 2020 905 views
WordPressJava

Hello,
I want to run my existing java+angular app as well as Wordpress app on same droplet. I have seen multiple examples to do same thing with two different domains. However i want to run wordpress on https://domain.com and angular+java app on https://mydomain.com/app.
I am using nginx as server for my java+angular app which is currently deployed at https://mydomain.com
Please help!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

When using Nginx or any other service you can use Vhosts to get what you want.
Have one directory listen to a specific /folder and the other to another. We need some specific information here however to help you on this specific request;

  • What does your current nginx file look like?
  • Where are the different webserver files located?
  • Does the angular service run a different port?

Let me know if this helps you or got any more questions.

  • Hello,
    Thanks for reply

    1>I have a java sprint boot API which works at localhost:8999

    2> I have Angular app which needs to be hosted at mydomain.com/app. Angular app internally calls spring boot api . at mydomain.com/app/api which i need to redirect to above api at localhost :8999

    3> My WordPress needs to be hosted at mydomain.com

    I want to to make this configuration.
    Please help me understand how will my Nginx configuration should look like

    NOTE: i used digital ocean one click installer to install lemp stack . so i have barebones lemp ready where i can install wordpress in root path (mydomain.com)

    • Were you able to figure this out? I’m in a similar situation.

      I have my angular app www.example.com. My api is www.example.com/api
      and I have other angular components that have other urls like www.example.com/admin

      However, I’m looking to install the wordpress at www.example.com/blog, but it doesn’t seem to be working for me properly. I got it to load the admin page; however, there are other files that it seems like it can’t load properly (other .js files). So the wordpress page isn’t loading properly.

      • Hi, Did you solve this problem? I am also in this situation. I want to publish wordpress and angular(spring boot) project on same droplet but I cannot configure nginx properly. How did you solve this problem?

        Thanks.

Submit an Answer