I have set up a reverse proxy with apache and am pointing to 4 other apache wordpress server vm's on my local network.
When I go to the websites on 3 of them (like www.mywebsite.com externally from my computer at work), they resolve fine and the sites produce the page correctly.
When I try to connect to the 4th site, it redirects me to a 192 address which is what I have in the proxy config but it does not resolve correctly like the other sites. I literally copy and pasted each block in the 000-default.conf so I know they are identical.
The proxy works and is moving the traffic but will try to resolve locally. Here is the block from my 000-default.conf.
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName www.mywebsite.com
ServerAdmin myemail#gmail.com
DocumentRoot /var/www/html
ProxyPass / http://192.168.1.23:80/
ProxyPassReverse / http://192.168.1.23:80/
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
Im not sure what is different between the sites. Ive done this quite a few times and never had the issue. Could this be an issue with the web server on the 4th site? These are all VM's running ubuntu server with lamp.
It looks like it was an issue with the 4th server and how it was handling the index file with wordpress. It seems that Wordpress had to be provisioned locally first. But, I dont remember doing this with the other sites. All is well now.
Related
I currently have a domain, and want to point my folder to my apache config file, to then use certbot, but I dont know how to exactly point it. So far I've done:
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerName mydomain.org
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html/bfia
#..other stuff
</VirtualHost>
Where /var/www/html/bfia is the directory of the express app and the rest of the needed files. As of right now, the only page that appears is the default apache page.
You have to allow or deny access to that directory using the "Directoiry" module (https://httpd.apache.org/docs/2.4/sections.html). You also need to configure the directoryIndex to define which file read and present to the client (https://httpd.apache.org/docs/2.4/mod/mod_dir.html#directoryindex).
I have asked this question in OTRS forum but their primary focus is the functionality of OTRS and not really the interaction with an apache proxy.
I have an internal server running OTRS (Perl based support ticket system).
I have a reverse proxy in my DMZ that performs proxy and SSL offload for internal web pages/applications. My proxy server is Ubuntu 18 with Apache2. It mostly works except that for OTRS I get weird page errors. It used to not be bad but since update from OTRS 5 to OTRS6 it is so bad that we cannot we https except to log in.
If I use https it throws a message that "OTRS has detected possible network issues" and says to reload the page or wait till the browser establishes connection on it's own. If I wait just a bit I get a new message that states "the connection has been re-established after a temporary connection loss. Due to this elements on this page could have stopped working correctly" it goes on to say that you need to reload the page. But it just keeps cycling through these message in a flapping error.
I also get additional slash marks (/) each time I move to a new ticket.
Like so: https://myotrs.mydomain.com/otrs////////////index.pl?
The slash mark addition happens on both http and https through the proxy. It only happens on the OTRS site, not on my others handled by the same proxy.
Here is sample of my proxy vhost file.
<VirtualHost *:443>
ServerName help.mydomain.com
ServerAlias help.mydomain.net
ServerAdmin it#mydomain.com
ErrorLog /var/log/apache2/proxiedhosts-ssl_error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel info
CustomLog /var/log/apache2/access-ssl.log combined
ProxyRequests off
ProxyPass / http://helpdesk.mydomain.local/
<Location /otrs>
ProxyPassReverse http://helpdesk.mydomain.local/otrs/
</Location>
<Location /otrs-web>
ProxyPassReverse http://helpdesk.mydomain.local/otrs-web/
</Location>
# Use mod_proxy_html to rewrite URLs
SetOutputFilter proxy-html
# commented out
https://help.mydomain.com/otrs/
https://help.mydomain.com/otrs-web/
# Disable compressed communication between Apache and target server
RequestHeader unset Accept-Encoding
# SSL Engine Switch:
# Enable/Disable SSL for this virtual host.
SSLEngine on
# Allows the proxying of an SSL connection
SSLProxyEngine On
# certificate
SSLCertificateFile /etc/ssl/certs/help.mydomain.com/help.mydomain.com.crt
SSLCertificateKeyFile /etc/ssl/private/SHA2_mydomain.key
</VirtualHost>
I have checked out your config file, and i suggest you try to change
<Location /otrs>
ProxyPassReverse http://helpdesk.mydomain.local/otrs/
</Location>
to
<Location /otrs/>
ProxyPassReverse http://helpdesk.mydomain.local/otrs/
</Location>
In the original config file, if you browse https://myotrs.mydomain.com/otrs/index.pl you will be redirect to https://myotrs.mydomain.com/otrs//index.pl. And then, if you click the page, you will be redirect to https://myotrs.mydomain.com/otrs///index.pl. Then you are stuck in the circulation.
its the first time I try to host a website.. First i bought an domain on "Strato" and I got apache running on this domain via a ubuntu server and our fitzbox using Dyndns. But now i want to do the next step and host a subdomain. I created a subdomain on the strato web interface and tryed to set it up in apache, but i can't connect to it. If i change the DynDns in our fritzbox to the subdomain i can connect to the subdomain but not to the normal Domain, u know what i can do to reach both of them via the internet?
In apache I created this 2 files: 000.default.conf ---- both of them are enabled
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName www.SaneQt.de
ServerAdmin webmaster#localhost
DocumentRoot /var/www/000
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
001-oneway.conf
<VirtualHost *:80>
ServerName onewaygaming.saneqt.de
DocumentRoot /var/www/001
</VirtualHost>
FritzboxSettings: port 80 is open and I used this setting Fritzbox DynDns Settings
Strato: Strato Domains
Im really sry for my english, im not the best in scool i hope u can ignore the fact...
Thanks in advance!!
Your apache settings are OK, the problem is with DNS:
onewaygaming.saneqt.de:
;QUESTION
onewaygaming.saneqt.de. IN A
;ANSWER
onewaygaming.saneqt.de. 149 IN A 81.169.145.156
www.SaneQt.de:
www.SaneQt.de. IN A
;ANSWER
www.SaneQt.de. 149 IN CNAME SaneQt.de.
SaneQt.de. 59 IN A 46.243.84.57
At this moment, http://www.saneqt.de/ is responding with Hallo welt so I guess that it has correct settings. If so, you need to configure the CNAME record for onewaygaming.saneqt.de exactly the same as you did for www.SaneQt.de.
I'm working on a project and I would like to make some things in order to be able to handle easier my distant server.
I have a server on which one I installed an API (dolibarr - ERP/CRM software).
This server uses Ubuntu 14.04 and Apache2.
When I want to connect to my software from the net, I open Firefox for example, I write http://172.30.10.XX and I am going to the application login page.
But I would like to create a DNS and domain name in order to connect it easier.
For example :
http://shopmoriba.datasystems.fr instead to write the IP address.
My question is : How I can do that ?
I know that I need to modify some files : /etc/apache2/sites-available/000-default.conf or /etc/hosts but what I need to write exactly ?
My /etc/hosts file looks like :
127.0.0.1 localhost
//127.0.1.1 dolibarr
172.30.10.69 shopmoriba.datasystems.fr
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
My /etc/apache2/sites-available/000-default.conf looks like :
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html/
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Thank you by advance
There should be no need to touch the /etc/hosts on your server.
The important thing to make this work is to make the name known to all clients that want to access your application. To do this you basically have two possibiliies:
Add an entry to all /etc/hosts (on windows this is C:\Windows\System32\drivers\etc/hosts) on all clients that are meant to access your application. Doing it this way is not recommended
Add a DNS-record for shopmoriba.datasystems.fr in some DNS-server that will be accessed by all clients that are meant to access the application. If this is solely for internal use go with some DNS-server on your network, perhaps there already is one. If you want to make the application publicly available there is no way around registering an official domain and publishing the hostname via the associated DNS-server.
While you only run one application on your server this will be sufficient. Once you start adding other application that you want to publish under a different hostname you will have to add more <VirtualHost>-sections and add a ServerName-line like
`ServerName shopmoriba.datasystems.fr`
to the respective VirtualHost-configuration.
I ommited the topic of using https since you did not mention you want to use it and especially on servers hosting multiple vhosts it is enough for a separate topic.
You can add the entry to /etc/hosts in the following format:
172.30.10.XX shopmoriba.datasystems.fr
Bear in mind that this will only work on the local machine where the hosts file has changed.
I want to set up a single virtual host that can dynamically handle all requests based on the hostname used to access it. If %{HTTP_HOST} could be used in a DocumentRoot, this is probably exactly what I want:
<VirtualHost *:80>
ServerAdmin me#example.com
DocumentRoot /var/www/live/%{HTTP_HOST}/public
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/live/%{HTTP_HOST}/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
LogLevel warn
ErrorLog /var/www/live/%{HTTP_HOST}/logs/error.log
CustomLog /var/www/live/%{HTTP_HOST}/logs/access.log combined
</VirtualHost>
...unfortunately, %{HTTP_HOST} is not allowed in the DocumentRoot (Warning: DocumentRoot [/var/www/live/%{HTTP_HOST}/public] does not exist). How else can I achieve my goal?
Update: I thought of pointing a catch-all vhost to a single directory and having a .htaccess use mod_rewrite to dynamically select the path but (honestly) I'm exhausted. I'll try at it again in the morning, but in the meantime, if anyone has good ideas, I'd love to hear them! Thank you!
Maybe you can try the following solution from this article: Apache: Dynamic Virtual Hosts
A few months back I looked for a solution to overcome the problem of
creating individual Virtual Hosts in Apache every time I wanted to
configure a new site on a development machine (something that is a big
issue in work where we have a lot of websites). Apache is able to
support this functionality relatively easy using a module and a few
lines in the configuration file. I set this up on Fedora 14, so
results may be slightly different for other OS's (different paths,
configuration file setup, etc)
Open up the main Apache conf (/etc/httpd/conf/httpd.conf), and ensure
the module mod_vhost_alias is enabled. There should be a line in the
configuration like
LoadModule vhost_alias_module modules/mod_vhost_alias.so
Next, add the
following lines to the bottom of this file. You'll need to edit the
file with sudo privileges.
NameVirtualHost *:80
UseCanonicalName Off
<VirtualHost *:80>
VirtualDocumentRoot /var/www/html/domains/%0
</VirtualHost>
This sets up a catch all for any domain coming in over port 80 (the
default port for http traffic, if your using https you will need to
use 443 - alternatively you could remove the port restriction). The
important line here is the VirtualDocumentRoot. The tells Apache where
your files will reside on disk. The %0 part takes the whole domain
name and inserts it into the path. To illustrate this if we went to a
domain testing.com.dev the VirtualDocumentRoot would be:
/var/www/html/domains/testing.com.dev
This type of configuration might
be suitable for most situations, however I didn't want to have the
.dev part of the domain in my folders on disk. I was able to achieve
this by setting the VirtualDocumentRoot to:
VirtualDocumentRoot /var/www/html/domains/%-2+
The above example of testing.com.dev would now point to:
/var/www/html/domains/testing.com
Remember to add the domain to your
hosts file (/etc/hosts)
For a full list of options see the mod_vhost_alias documentation.
Additional documentation can be found here.
The official methods for achieving dynamic virtual hosts are explained in the Apache documentation:
http://httpd.apache.org/docs/2.0/vhosts/mass.html