Proxy reverse apache and adonis.js DEPLOY

I have a project in adonis.js - node.js, I want to deploy the project together with others that I have from laravel in apache, so I will not use nginx, I have the following lines in the file in 000-default .conf, the file is linux-ubuntu.

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
<Directory />
    Options -Indexes +FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>
ProxyRequests Off
ProxyPreserveHost On
ProxyVia Full
<Proxy *>
    Require all granted
</Proxy>

<Location /appadonis>
    ProxyPreserveHost On
    ProxyPass http://localhost:3333
    ProxyPassReverse http://localhost:3333
</Location>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined

But when entering the app through the url localhost / appadonis, it does not recognize the routes or the css files http: //localhost/style.css net :: ERR_ABORTED 404 (Not Found) It is not working the file paths,

1 Like

Hi!

Did you solved this problem?

I faced this kind of issue once with apache. The best way to apprach a reverse proxy is with another Virtual Host (a personal opinion). But if you need this to work together the only thing I can see is:

1.- You are not defining the DocumentRoot for the Adonisjs folder, and
2.- In definition, you need to finish the path with a slash (’/’).

In first place, try with this:

<Location /appadonis/>
    ProxyPreserveHost On
    ProxyPass http://localhost:3333
    ProxyPassReverse http://localhost:3333
</Location>

If this doesn’t work, I’d suggest split the virtual hosts.

Cheers.

1 Like