The goal is to listen on port 80 with nodejs without killing apache.
I have to say my knowledges in network are very basic.
UPDATE
I am trying to use ProxyPass ProxyPassReverse on my local machine but there is something wrong.
Alias /test /media/www-dev/public/test
<Directory /media/www-dev/public/test>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ProxyRequests off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location />
ProxyPass /test http://localhost:3000/
ProxyPassReverse /test http://localhost:3000/
</Location>
When i launch http://localhost/test on my browser i get a message Cannot GET /test/, if i stop to listen on the port 3000, then i get 503 Service Temporarily Unavailable my node app is listening on the port 3000.
If if commente the "Proxy" lines, i can reach the URL http://localhost/test again.
Why can i not access the URL http://localhost/test ? Is it because the proxy try to reach http://localhost:3000/ instead following the path of the alias /test ?
Thanks !
you need to create a virtual host in apache for your node app and proxy over the requests.
here is what mine looks like in /etc/apache/sites-available/dogself.com
<VirtualHost 69.164.218.75:80>
ServerName dogself.com
ServerAlias www.dogself.com
DocumentRoot /srv/www/dogself.com/public_html/
ErrorLog /srv/www/dogself.com/logs/error.log
CustomLog /srv/www/dogself.com/logs/access.log combined
ProxyRequests off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location />
ProxyPass http://localhost:3000/
ProxyPassReverse http://localhost:3000/
</Location>
</VirtualHost>
It sounds like you have a lot to research before you can get this working though. start reading docs
Alternative approach for a virtual host would be the following
<VirtualHost *:80>
ServerAdmin info#DOMAIN.com
ServerName DOMAIN.com
ServerAlias www.DOMAIN.com
ProxyRequests off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location />
ProxyPass http://localhost:3000/
ProxyPassReverse http://localhost:3000/
</Location>
</VirtualHost>
To fix the Internal Server ERROR just enable the right apache extension.
sudo a2enmod proxy_http
sudo service apache2 restart
Related
In my Apache configuration I have two virtual server setups, one for 80 and one for 443. My VirtualHost *:80 config successfully proxies/redirects a path to tomcat 8080, but my analogously configured VirtualHost *:443 config is not proxying to the required tomcat 8443.
I have checked the Connector in tomcat and can successfully hit the tomcat endpoints directly over 8443. I can also hit other parts of the web-server over 443, just not any of the app-server endpoints that require the proxy/redirect. So, I know that the certs and tomcat configs are working.
Apache and Tomcat are running on the same ec2 server.
<VirtualHost *:80>
ServerName cloviscorp.com
DocumentRoot /var/www/html/com/cloviscorp
<Directory "/var/www/html/com/cloviscorp">
Order Allow,Deny
Allow From All
AllowOverride All
Options -Indexes
</Directory>
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPreserveHost On
ProxyPass /ClovisWebApp http://localhost:8080/ClovisWebApp
ProxyPassReverse / http://localhost:8080/
... (CORS config and LOG setup) ...
</VirtualHost>
<VirtualHost *:443>
ServerName cloviscorp.com
DocumentRoot /var/www/html/com/cloviscorp
<Directory "/var/www/html/com/cloviscorp">
Order Allow,Deny
Allow From All
AllowOverride All
Options -Indexes
</Directory>
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPreserveHost On
ProxyPass /ClovisWebApp https://localhost:8443/ClovisWebApp
ProxyPassReverse / https://localhost:8443/
SSLEngine on
SSLCertificateFile "/etc/httpd/server.crt"
SSLCertificateKeyFile "/etc/httpd/server.key"
... (CORS config and LOG setup) ...
</VirtualHost>
When hitting http://www.cloviscorp.com/ClovisWebApp/authenticationservice/login I correctly proxy to http://www.cloviscorp.com:8080/ClovisWebApp/authenticationservice/login, but when I hit https://www.cloviscorp.com/ClovisWebApp/authenticationservice/login I get The requested URL /ClovisWebApp/authenticationservice/login was not found on this server.
I need to define two virtual host that should forward my requests to different web applications.
IP of PC where appache is installed is: 192.168.100.208.
IP of application server where application are installed is: 192.168.100.50
<VirtualHost *:7778>
ServerName 192.168.100.208
ProxyRequests On
ProxyPreserveHost Off
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
ProxyErrorOverride On
ProxyPass / http://192.168.100.50:9081/app1/
ProxyPassReverse / http://192.168.100.50:9081/app1/
<Location>
Order allow,deny
Allow from all
</Location>
and I need to have:
<VirtualHost *:7777>
ServerName 192.168.100.208
ProxyRequests On
ProxyPreserveHost Off
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
ProxyErrorOverride On
ProxyPass / http://192.168.100.50:9081/app2/
ProxyPassReverse / http://192.168.100.50:9081/app2/
<Location>
Order allow,deny
Allow from all
</Location>
So when I type in browser:
192.168.100.208:7778 i should get page from 192.168.100.50:9081/app1
and
192.168.100.208:7777 i should get page from 192.168.100.50:9081/app2
But above is not working. Where is mistake?
Make sure to have the following configured also:
#
# Use name-based virtual hosting.
#
NameVirtualHost *:7778
NameVirtualHost *:7777
I am new to Meteor, and I have an existing server that is hosting a few websites (CentOS). I use Apache to serve the sites and wanted to have a Meteor app running on a subdomain.
Here is what I have for the Meteor site in httpd.conf:
<VirtualHost *:80>
ServerName www.subdomain.domain.net
ServerAlias subdomain.domain.net
DocumentRoot /var/www/my_meteor_directory/testapp
ProxyRequests Off
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
ProxyPass / http://127.0.0.1:3000
ProxyPassReverse / http://127.0.0.1:3000
</VirtualHost>
I also have this at the bottom of my httpd.conf file:
<Proxy *>
Allow from 127.0.0.1
</Proxy>
ProxyPreserveHost On
ProxyPassMatch ^/(.+\.cf[cm])(/.*)?$ ajp://localhost:3000/$1$2
I set the app to run on port 3000 and when I try to hit it in the browser (subdomain.domain.net) I get these 502 errors:
Any suggestions?
Try this...
<VirtualHost *:80>
ServerName meteorapp.example.com
ProxyRequests off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location />
ProxyPass http://localhost:8080/
ProxyPassReverse http://localhost:8080/
</Location>
</VirtualHost>
then reload the server
I have already tried using ws:// over https in firefox using some flag configuration. Is there any way to enable this configuration in IE 10 . May be by adding some reg entry it can be done but i don't know exactly which key vale to edit?
I have configured my https using apache httpd service. Which routes to my play portal URL. Is there any setting/config extra i am missing. Here is my httpd configuration:
<VirtualHost *:80>
ServerName myhost
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
SSLEngine on
SSLProxyEngine On
SSLCertificateFile /etc/ssl/certs/my.crt
SSLCertificateKeyFile /etc/ssl/private/my.key
ProxyRequests on
ProxyPreserveHost off
<Location />
SetHandler balancer-manager
Order allow,deny
Allow from all
</Location>
#ProxyPass /excluded !
ProxyPass / http://host-to-route:9701/
ProxyPassReverse / http://host-to-route:9701/
</VirtualHost>
Please suggest.
Thanks,
Sohan
I have a server with only one IP adress but a lot of domain (and sub-doman) but every domain have dedicated virtual machine on my Host Server.
I try to use mod_proxy for ProxyPass and Reverse request and, in apache conf i make it:
<VirtualHost *:80>
ServerAlias mydomain.domain.com
ProxyRequests Off
<Proxy />
Order deny,allow
Allow from all
ProxyPass http://192.168.1.8/
ProxyPassReverse http://192.168.1.8/
</Proxy>
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
ErrorLog ${APACHE_LOG_DIR}/error.log
</VirtualHost>
<VirtualHost *:80>
ProxyRequests Off
ServerAlias domain.domain2.org
ServerAlias subdomanin.domain.com
DocumentRoot /var/www
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
ErrorLog ${APACHE_LOG_DIR}/error.log
</VirtualHost>
In this conf:
domain.domain1.com -> go to 192.168.1.8
subdomanin.domain1.com and another domain -> go to document root.
With ProxyRequests On and "Allow from All" (this conf), apache is an openproxy...
With this config (and ProxyRequest Off), if someone request "www.google.it" with proxy mydomain.domain.com he don't have google but server redirect it to myNumericIp
What is right config for do if http://mydomain.domain.com/some request are redirect to myNumericIp with url http://my.Numeric.Ip/some otherwhise proxy don't response anything).
I try this:
<Proxy http://mydomain.domain.com/>
Order deny,allow
Allow from all
ProxyPass http://192.168.1.8/
ProxyPassReverse http://192.168.1.8/
</Proxy>
Or this:
<Proxy />
Order deny,allow
Allow from all
ProxyPass http://192.168.1.8/
ProxyPassReverse http://192.168.1.8/
</Proxy>
<Proxy *>
Order deny,allow
Deny from all
</Proxy>
But don't work...
Using the following steps:
1) Update virtual file:-
<VirtualHost *:80>
ServerAdmin admin#test.com
ServerName mysite.com
ServerAlias www.mysite.com ProxyRequests Off Order deny,allow Allow from all <Location />
ProxyPass http:// mysite.com:8000/
ProxyPassReverse http:// mysite.com:8000/
</Location>
2) Enabling Necessary Apache Modules
To enable these four modules, execute the following commands in succession.
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod proxy_balancer
sudo a2enmod lbmethod_byrequests
3) To put these changes into effect, restart Apache.
sudo systemctl restart apache2