I configured my Debian server with Apache where I listen to my api at http: // localhost or http: // localhost: 3000 and I get my jsons.
Now I would like to enable another server in www / html / uploads, where I will use it for uplodas files. How do you do it?
\
000-default.conf:
<VirtualHost *:80>
# ProxyPreserveHost On
# Servers to proxy the connection, or;
# List of application servers:
# Usage:
# ProxyPass / http://[IP Addr.]:[port]/
# ProxyPassReverse / http://[IP Addr.]:[port]/
# Example:
ProxyPass / http://localhost:3000/
#ServerName localhost
</VirtualHost>
You can either write to the 000-default.conf file or create a new .conf file
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /www/html/uploads
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Related
I am trying to redirect a virtualhost to a spefcific ip, in A docker network in my case.
I am on a raspberrypi4 with archlinux.
So, here is my config file, but it do not work, this redirect in my default vhost in local :
<VirtualHost *:80>
#ServerAdmin webmaster#mysite.com
#DocumentRoot "/srv/http/mysite.com"
ServerName mysite.com
ServerAlias mysite.com
ErrorLog "/var/log/httpd/mysite.com-error_log"
CustomLog "/var/log/httpd/mysite.com-access_log" common
ProxyPreserveHost On
ProxyPass "/" "http://172.19.0.5/"
ProxyPassReverse "/" "http://172.19.0.5/"
# <Directory "/srv/http/http/mysite.com">
# Require all granted
# </Directory>
</VirtualHost>
does anybody can help me to fix that ?? :/
I have a server which uses a domain example.com. I am using apache to run this web server. I have also installed Dot Net core and published a Dot Net core app to /var/www/app location.
I a trying to access this application using example.com/api
This below is what I have tried in 000-default.conf
<VirtualHost *:80>
ServerAdmin root#example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
the below is what I hvae added for the application
<VirtualHost *:80>
ServerName example.com/api
ProxyPreserveHost On
<Proxy *>
Order allow, deny
Allow from all
</Proxy>
ProxyPass / http://localhost:5000/
ProxyPassReverse / http://localhost:5000/
</VirtualHost>
I have also tried the below configuration.
<VirtualHost *:80>
ServerName example.com/api
redirect / http://localhost:5000/
</VirtualHost>
can someone please help me find what am I doing wrong and how to achieve this properly.
This is solved by enabling proxy and proxy_http using commands below.
a2enmod proxy
a2enmod proxy_http
Also configured the Proxy inside the virtual host as follows.
<VirtualHost *:80>
ServerAdmin root#example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/html
#Below 3 lines worked
ProxyPreserveHost On
Proxypass "/api/" "http://localhost:5000/"
ProxyPassReverse "/api/" "http://localhost:5000/"
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
I'm using Apache2 in ubuntu to rout the request to a tomcat webapp. I am also trying to add SSL into this. Below is the apache 000-default.conf file.
<VirtualHost *:80>
ProxyPreserveHost On
# Servers to proxy the connection, or;
# List of application servers:
# Usage:
# ProxyPass / http://[IP Addr.]:[port]/
# ProxyPassReverse / http://[IP Addr.]:[port]/
# Example:
ProxyPass / http://0.0.0.0:8080/
ProxyPassReverse / http://0.0.0.0:8080/
ServerName localhost
</VirtualHost>
<VirtualHost *:443>
ServerAdmin webmaster#localhost
DocumentRoot /opt/apache-tomcat-7.0.79/webapps/myglukose_messaging_portal/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine On
# Set the path to SSL certificate
# Usage: SSLCertificateFile /path/to/cert.pem
SSLCertificateFile /etc/apache2/ssl/STAR_myglukose_com.crt
SSLCertificateKeyFile /etc/apache2/ssl/private_key.key
ProxyPreserveHost On
ProxyPass / http://<my-ip>/:8080/
ProxyPassReverse / http://<my-ip>/:8080/
ServerName localhost
</VirtualHost>
Everything was fine until I made the configuration for port 443. When that is made, the site simply becomes unavailable and the browser says "This site can’t be reached. refused to connect.". My tomcat web app is deployed as "ROOT" so can be accessed with the port 80 configuration. Whats wrong here?
By clash I mean that one domain works, it leads to /var/www/html and reads the main index.php file however the second domain which leads to /var/www/html/website gives me a permission denied for root directory "/" so I'm wondering if it is interpreting /var/www/html as /
Or is it something else?
Thank you for any help
Virtual host setup port 80 only
# works
<VirtualHost *:80>
ServerName www.site.us
ServerAlias site.us http://www.site.us
DocumentRoot /var/www/html
# CustomLog /directory log file location not enabled
# ErrorLog /directory log not enabled
</VirtualHost>
# both site2.com and www.site2.com have 404 problem
# The requested URL / was not found on this server.
<VirtualHost *:80>
ServerName www.site2.com
ServerAlias site2.com http://www.site2.com
DocumentRoot /var/www/html/site2
# CustomLog /directory log file location not enabled
# ErrorLog /directory log not enabled
</VirtualHost>
# works fine
<VirtualHost *:80>
ServerName www.site3.com
ServerAlias site3.com http://www.site3.com
DocumentRoot /var/www/html/site3
# CustomLog /directory log file location not enabled
# ErrorLog /directory log not enabled
</VirtualHost>
How I can hide the port 8080 from the address bar?
when I call my sub.domain.com I get nothing but when I call my sub.domain.com:8008 I get the application!
I am using apache2 and jboss 7
Thanks
<virtualhost *:80>
ServerName sub.domain.com
ServerAlias sub.domain.com
<Location /myapp>
Order deny,allow
Allow from all
Options -Indexes FollowSymLinks
ProxyPass http://127.0.0.1:8080/myapp
ProxyPassReverse http://127.0.0.1:8080/myapp
</Location>
DirectoryIndex index.html index.htm index.php index.asp index.aspx index.jsp index.jspa index.shtml index.shtm
</virtualhost>
just and copy and past this config to your sites-enabled
<VirtualHost *:80>
ProxyPreserveHost On
# Servers to proxy the connection, or;
# List of application servers:
# Usage:
# ProxyPass / http://[IP Addr.]:[port]/
# ProxyPassReverse / http://[IP Addr.]:[port]/
# Example:
ProxyPass / http://0.0.0.0:8080/
ProxyPassReverse / http://0.0.0.0:8080/
ServerName localhost
</VirtualHost>
you can hide the port from address bar, try to start sever using port 80 , you can change the stanalone.xml file
<socket-binding name="http" port="80"/>