Apache2 forward to other services - apache2

I'm trying to set up both a gitea instance and another service on a server. The service is already on port 80, and gitea runs on port 3000. I would like to use apache2 to listen on port 80 and based on the cname redirect the traffic, so mysite.com -> gitea instance and othersite.com -> other service.
In /etc/apache2/sites-available/ i modified the 000-default.conf and i now have these 2 entries:
<VirtualHost *:80>
ServerName mysite.com
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
</VirtualHost>
<VirtualHost *:80>
ServerName othersite.com
</VirtualHost>
In my local dns I have both names point to the ip of the server.
It doesn't work and both mysite.com and othersite.com show the service on port 80 and can connect to port 3000 after the domain.

Related

Running grafana behind apache2 reverse proxy

I need to run grafana and kibana on a same server while running behind Apache2 reverse proxy
I manage to succeed with kibana, but grafana cause me some problems; in fact I don't how how to run the sub path.
I want these two services to run like this : X.X.X.X/kibana and X.X.X.X/grafana.
Here is my apache2 config and my grafana settings:
<VirtualHost *:80>
ServerName http://myipadress/kibana
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://myipadress:5601/
ProxyPassReverse / http://myipadress:5601/
</VirtualHost>
#--------------GRAFANA----------------------------
<VirtualHost *:80>
ServerName http://myipadress/grafana
ProxyRequests On
ProxyPreserveHost On
ProxyPass / http://myipadress:3000/
ProxyPassReverse / http://myipadress:3000/
</VirtualHost>
For grafana :
protocol = http
http_port = 3000
domain = myipadress
root_url = %(protocol)s://%(domain)s:%(http_port)s/grafana
serve_from_sub_path = true
Does anyone know what I did wrong
Cheers
Hello after loosing too much time on it, I decided to change my reverse proxy and use NGINX.
I fact, there is a example of configuration in grafana's documentation, and I just added these lines
location /kibana {
proxy_pass http://localhost:5601/kibana;
}
And it just work for me

Url and port redirection apache 2

My problem is that i configured my dns to redirect two urls towards my server url but one of them must contain the port.
exp
www.xxxx.com---> xxx.fff.fff.ggg
www.yyyy.com---->xxx.fff.fff.ggg:8080
but since dns don't accept port in the conf how should i configure the apache2 server to redirect the url to url:port?
thank you
Create name-based virtual host on port 80 (this is routine). In the virtualhost with ServerName www.yyyy.com, redirect all traffic to www.yyyy.com:8080.
# Only in 2.2:
NameVirtualHost *:80
<Virtualhost *:80>
ServerName www.xxxx.com
</virtualhost>
<Virtualhost *:80>
ServerName www.yyyy.com
Redirect / http://www.yyyy.com:8080/
</virtualhost>

Odoo 8 deploy website with reverse proxy (apache2)

Hello I'd like to deploy my website using Apache2, my domainname is www.hew-automation.be. I've already made a link from this domainname to my server's IP Address (http://91.183.84.209:8080/). I want to get rid of the port 8080 and also stop displaying the IP address in the browser.
I installed apache2, added following to /etc/apache2/sites-available/odoo.conf:
<VirtualHost *:80>
ServerName hew-automation.be
ServerAlias *.hew-automation.be // Use this if you want dbfillter on subdomain
ErrorLog /var/log/odoo/odoo-error.log
CustomLog /var/log/odoo/odoo-access.log combined
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyRequests Off
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
ProxyVia On
LogLevel warn
</VirtualHost>
Then enabled this with a2ensite, this without any errors.
This is my /etc/odoo-server.conf file:
[options]
admin_passwd = XXXX
db_host = False
db_port = False
db_user = XXXX
db_password = XXXX
addons_path = /opt/odoo/addons
logfile = /var/log/odoo/odoo-server.log
xmlrpc_port = 8068
Now whenever I surf to my IP-address http://91.183.84.209/, it always shows the default page of Apache2, what am I doing wrong here?
Thanks.

configurations for the Subdomain module in drupal 7

What are the appropriate configurations for the Subdomain module in drupal 7 on Window 7 running XAMPP?
My site is localhost/example
Here are the changes I have made:
settings.php
$cookie_domain = '';
Leaving this commented out gives me an error
"The $cookie_domain variable in settings.php is not set".
Uncommenting and putting in "localhost", ".localhost", "example", ".example" gives me an "Access denied" error.
It seems to accept "localhost/example" or a blank ' ', although I don't know if this is the right thing to do.
host
127.0.1.1 localhost example
(and I can successfully ping ideastar)
http.conf
NameVirtualHost *:80
<VirtualHost *:80>
ServerName example
ServerAlias *.example
DocumentRoot C:/xampp/htdocs
</VirtualHost>
getting the fallowing error
Subdomain error: localhost and subdomain-test.localhost did not resolve to the same IP address. Your DNS may be improperly configured and subdomains will likely not work.
First you should create two virtual host one for main domain and another for sub-domain. For ex: like we have two domains example.com and test.example.com to setup on local host. I am assuming that you have a fresh install of Xampp on your machine. Your virtual host [\xampp\apache\conf\extra\httpd-vhosts.conf] file should have these entries:
<VirtualHost *:80>
DocumentRoot "\xampp\htdocs\example"
ServerName example.com
ServerAlias example.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "\xampp\htdocs\example"
ServerName test.example.com
ServerAlias test.example.com
</VirtualHost>
Now open you system host file and make the following entries below the line "127.0.1.1 localhost" (localhost ip 127.0.0.1)
127.0.1.1 example.com
127.0.1.1 test.example.com
\xampp\htdocs\example this directory should contain your Drupal setup.
Cookie domain entry should be as per the below line
$cookie_domain = '.example.com';
i have assumed that you already have a Drupal site running at http:\localhost\example.

Named virtual local host?

I've a local apache2 site which works if I have:
<VirtualHost *:80>
ServerName localhost
...
</VirtualHost>
<VirtualHost *:443>
ServerName localhost
in .conf file. So when I point browser to localhost I get to the site. How do I assign name to the site? E.g. I want example.com drive me there.
I tried to set the ServerName and NameVirtualHost:
NameVirtualHost 172.20.30.40:80
NameVirtualHost 172.20.30.40:443
<VirtualHost 172.20.30.40:80>
ServerName www.example.com
...
<VirtualHost 172.20.30.40:443>
ServerName www.example.com
But it doesn't work.
Edit:
I'm on linux (kubuntu).
Edit 2:
I also tried to
<VirtualHost *:80>
ServerName example.com
...
</VirtualHost>
<VirtualHost *:443>
ServerName example.com
Also set example.com as the server name in the underlying database (postgresql). And in /etc/hosts:
127.1.0.0 example.com
After restarting my app and apache I expected 127.1.0.0 to reditect me to my site. When I actually point browser to 127.1.0.0 it tries to go somewhere but couldn't make it.

Resources