Im trying to publish nestjs service with angular front. Angular works correctly but nest dont.
<VirtualHost *:2000>
ServerName myservername
ServerAlias myserveralias
DocumentRoot /var/www/html/path/to/dist
<Directory /var/www/html/path/to/dist >
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
So far what I got is this directives. if i launch nest it says that port 2000 is already used but it doesnt respond to any request.
Related
I have a Traefik-2 docker-compose-setup for dev (and one similar for prod) with multiple docker-compose projects containing multiple dc-images, each can be reached locally like this: https://docker-app1.docker-doamin1.loc, incl. HTTPS/SSL-Certs; "dns" via /etc/hosts.
This works like a charm, when the traefik-container is running and the apache is not (port conflict otherwise)
I also have some projects that can be run directly on a local apache (on ubuntu/debian) with configurations in /etc/apache2/sites-available/ like this:
<VirtualHost *:80>
ServerName apache-app1.apache-domain1.loc
DocumentRoot /path-to/apache-app1.apache-domain1.loc/public
<Directory /path-to/apache-app1.apache-domain1.loc/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Require all granted
Fallbackresource /index.php
</Directory>
DirectoryIndex index.php index.html
</VirtualHost>
But only if the apache is running and the docker-traefik container ist not, again because of the conflicting 80/443
I need (or want) both Versions to run simultaneously.
My idea was to run the docker-traefik container on different ports (20080/20443) and redirect/ProxyPass from apache to that docker-proxy-container (the other way round would be okay too)
I tried (e.g.)this:
<VirtualHost *:443>
ProxyPreserveHost On
ProxyRequests Off
ServerName docker-app1.docker-doamin1.loc
ServerAlias www.https://docker-app1.docker-doamin1.loc
ProxyPass / https://docker-app1.docker-doamin1.loc:20443/
ProxyPassReverse / https://docker-app1.docker-doamin1.loc:20443/
</VirtualHost>
having
127.0.1.1 docker-app1.docker-doamin1.loc
in my /etc/hosts.
But it does not work. And it would be better in each case to have wildcards redirected like this: *.docker-doamin1.loc.
For now all of this is for a local dev environment, so security is not that relevant.
It would be great, if someone had some hints here.
I'm deploying my node.js app with apache on ubuntu following https://imstudio.medium.com/set-up-a-node-js-app-for-a-website-with-apache-on-ubuntu-18-04-e0323c333c20.
This node.js app is listening on port 4000. I put it in directory/var/www/html/api and start it by pm2.
After deployment, I tested my api and found that only my home url www.myweb.tk/api works, and other sub urls, for examplewww.myweb.tk/api/location, does not work.
Here is my conf file:
<VirtualHost *:80>
ServerName myweb.tk
ServerAlias www.myweb.tk
ProxyRequests Off
ProxyPreserveHost On
ProxyVia Full
<Proxy *>
Require all granted
</Proxy>
<Location /api>
ProxyPass http://127.0.0.1:4000/
ProxyPassReverse http://127.0.0.1:4000/
</Location>
</VirtualHost>
Can anyone tell me how to make other urls works? Thank you in advance.
I has same issue, but with nginx, i solved it by adding /api to proxy
Try to pass http://127.0.0.1:4000/api
UPD:
Or search for something like request url varible in Apache
I have 4 projects developed in laravel in Apache, now I finish a development in node.js with frmework adonis.js, I want to host that app in Apache as well, since all domain requests enter through port 80 or 443 with ssl, the case is that it creates directories to enter the applications
<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName localhost
Alias /app1 /var/www/html/app1/public
Alias /app2 /var/www/html/app2/public
Alias /app3 /var/www/html/app3/public
<Directory /var/www/html/app1/public/>
Order deny,allow
Allow from all
Options FollowSymLinks
</Directory>
<Directory /var/www/html/app2/public/>
AllowOverride All
Require all granted
Options FollowSymLinks
</Directory>
<Directory /var/www/html/app3/public/>
AllowOverride All
Require all granted
Options FollowSymLinks
</Directory>
the three directories work fine, but those are the 3 project directories in laravel, what should I do to create a 4 directory with the node application js - adonis.js that listens for http: // localhost: 3333 /
You don't need directory for nodejs app. Just start it on any port (I suggest running your app with process manager like pm2) and add proxypass to site config. In your case for port 3333 just add this:
ProxyPass / http://localhost:3333/
ProxyPassReverse / http://localhost:3333/
Of course mod_proxy must be enabled in your apache config.
I am developing node.js application and wants to deploy on apache server and run with https url only.
There is following url scheme I would like to configure on server.
https://example.com runs node js application on 1000 port from /home/main/public_html/ directory.
https://example.com:1335 runs node js application from /home/main/public_html/stagging/ directory.
https://example.com:4234 runs node js application from /home/main/public_html/development/ directory.
I want to achieve this type of url output from server.
I tried following way to achieve this but it display just directory listing only. I want to execute nodejs application.
<VirtualHost *:80>
ServerAdmin webmaster#domain.com
ServerName sub.domain.com
ProxyRequests Off
#Executes code from main directory
<Proxy https://whizbite.com:1000>
Order deny,allow
Allow from all
ProxyPreserveHost off
ProxyPass https://localhost:8080/
ProxyPassReverse https://localhost:8080/
</Proxy>
#Executes code from staging directory
<Proxy https://whizbite.com:1335>
Order deny,allow
Allow from all
ProxyPreserveHost off
ProxyPass https://localhost:8080/staging/
ProxyPassReverse https://localhost:8080/staging/
</Proxy>
#Executes code from development directory
<Proxy https://whizbite.com:4234>
Order deny,allow
Allow from all
ProxyPreserveHost off
ProxyPass https://localhost:8080/development/
ProxyPassReverse https://localhost:8080/development/
</Proxy>
</VirtualHost>
I really don't know how to achieve above url scheme by modification of apache configuration.
What I am trying to do
After running the command (export PORT=3000 && node server.js) my node.js app (StackEdit) is served at: http://example.com:3000/.
The command (export PORT=80 && node server.js) wouldn't work considering that Apache already uses port 80 on the server.
As I am new to Node.js, an easy way to make the node.js app available at http://example.com/ (i.e. port 80) would be to set up Apache as a reverse proxy.
Here's what I've tried
In /etc/apache2/sites-available/example.com.conf
Trial (1):
<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/example.com/public
ErrorLog /var/www/example.com/logs/error.log
CustomLog /var/www/editor.aahanblog.com/logs/access.log combined
ProxyPass / http://example.com:3000/
ProxyPassReverse / http://example.com:3000/
</VirtualHost>
This simply shows the directory listing for the public directory. So, in this case the requests aren't reaching the node.js app.
Trial (2):
<VirtualHost *:80>
ServerName example.com
ServerAlias *.example.com
DocumentRoot /var/www/example.com/public
ErrorLog /var/www/example.com/logs/error.log
CustomLog /var/www/example.com/logs/access.log combined
ProxyRequests off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location /var/www/example.com/public>
ProxyPass http://mydomain:3000/
ProxyPassReverse http://mydomain:3000/
</Location>
</VirtualHost>
This doesn't work either. It takes me to some default apache page.
What I am missing here?
Change your Location directive as
<Location /> from <Location /var/www/example.com/public>
basically, Location directive is a prefix of the path component of the URL