Apache and virtual host issues - apache

Feel like I am going slightly mad/round in a circle here so hoping someone can give me some pointers.
I have a Debian instance on AWS running apache. Inside of my /var/www/ folder I have another folder called dineosaw.com. I have a conf file called dineosaw.com.conf which looks like the following
<VirtualHost *:80>
ServerAdmin xxxx#gmail.com
ServerName www.dineosaw.com
ServerAlias dineosaw.com
DocumentRoot /var/www/dineosaw.com/public
<Directory /var/www/dineosaw.com/public>
Options -Indexes
AllowOverride All
Order Allow,Deny
Allow from All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
I then have forwarded my domain name (www.dineosaw.com) to the server by using the following address: http://52.56.144.228/. This however only took me to the apache default page. So I tried: http://52.56.144.228/dineosaw.com/ but this results in a 404 error.
Can anyone give me any pointers as to what I might be doing wrong/need to look in to? I would be very grateful.

If you want to address this name-based virtual host by IP address, you'd need "ServerAlias 52.56.144.228"

Related

Configure Apache to run website off of port-enabled IP address

To be perfectly honest, I'm not even sure if this is doable...
I've configured my vhosts file in /etc/apache2/sites-enabled which you can see here:
<VirtualHost 159.203.171.140:8080>
ServerAdmin webmaster#localhost
ServerName 159.203.171.140:8080
DocumentRoot "/home/wiki/public_html"
DirectoryIndex index.php index.html
<Directory "/home/wiki/public_html">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/wiki_error.log
CustomLog ${APACHE_LOG_DIR}/wiki_access.log combined
</VirtualHost>
for a digitalocean droplet given at the IP listed in the above hosts file. This droplet has absolutely nothing on it except for the wiki user in /home/ plus the required php, mysql/mariadb, apache stuff.
What I want to be able to do is to go to 159.203.171.140:8080 and see my site without having to purchase a useless domain name.
I'd really appreciate some help with this one.
If you have only one website on the droplet, then you don't need to set up a virtual host. You can use the 000-default.conf, no need for a2ensite.
You do not need the ServerName, which won't work with the IP as a name, you also don't need the IP address in the VirtualHost directive.
So, instead of this:
<VirtualHost 159.203.171.140:8080>
ServerAdmin webmaster#localhost
ServerName 159.203.171.140:8080
DocumentRoot "/home/wiki/public_html"
...
You can use this in your 000-default.conf file
<VirtualHost *:8080>
DocumentRoot "/home/wiki/public_html"
...
The rest of the directive stays as you have it.
Also, one note, if you are using port 8080, then you need go to /etc/apache2/ports.conf and set the Listen to 8080 (restart Apache after doing this).

404 Not Found in incorrect Apache configuration

I have a problem that apache configuration. Here my virtual host setting.
<VirtualHost *:80>
ServerName orocrm.75cl.sg
DirectoryIndex app.php
DocumentRoot /var/www/html/oro/web
<Directory /var/www/html/oro/web>
# enable the .htaccess rewrites
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
But, when I access to other menus, http://orocrm.75cl.sg/oro/web/app.php/ is always shown in front of the my targeted menu. So, it was shown 404 page. e.g http://orocrm.75cl.sg/oro/web/app.php/magento/cart/. It should be like that http://orocrm.75cl.sg/app.php/magento/cart/
May I know how do I fix this issue.
I recall that some versions of Apache come with a pre-configured vhost to point to the welcome.conf and such.
So I would suggest commenting the welcome.conf which is at /etc/httpd or on some distros /etc/apache2 and in those same directories find and remove any installation virtual hosts.
After that you should be free of conflicts as the pre defined virtualhost is like follows:
<VirtualHost *:80>
DocumentRoot "/var/www/welcome"
And that is all I can remember from last time looking at the file.
Enjoy

Apache won't start with added VirtualHost, but gives no error in error log

I am using EasyPHP (version 16.1.1) for Apache server (installed version 2.4.18 x86). I need to add a new VirtualHost, so now the whole VirtualHost section of httpd.conf looks like this:
# VIRTUAL HOSTS
## Virtualhost localweb
<VirtualHost 127.0.0.1>
DocumentRoot "C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www"
ServerName 127.0.0.1
<Directory "C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www">
Options FollowSymLinks Indexes ExecCGI
AllowOverride All
Order deny,allow
Allow from 127.0.0.1
Deny from all
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:8080>
UseCanonicalName Off
ServerAdmin marekbuchtela#gmail.com
ServerName posis
ServerAlias posis.tovarna
VirtualDocumentRoot "C:\Users\marek\is\tovarna\public"
</VirtualHost>
The first one is the default one made by EasyPHP, the second one is added by me. However in this setup, the Apache won't start. When I remove the second VirtualHost, everything works fine, but with it, it just won't start at all. I have checked the error log and there is no output at all.
Any ideas why is this happening/how to fix it?
Thanks
Switch VirtualDocumentRoot "C:\Users\marek\is\tovarna\public"for DocumentRoot "C:\Users\marek\is\tovarna\public"
If by any chance you keep getting the error, show error_log output
There is another instance other than the answer given by ezra-s as to why EasyPHP server won't start and the Apache error log is empty.
When declaring paths in the vhosts file, it is important that the directories referenced in those paths exist. If you provide the following VirtualHost information, for example:
<VirtualHost *:80>
DocumentRoot "D:/MyApp/public_html"
ServerName myapp.local
ErrorLog "D:/MyApp/logs/error.log"
CustomLog "D:/MyApp/logs/apache.log" common
</VirtualHost>
...but you don't have a D: drive, or the directories D:/MyApp/ and D:/MyApp/logs/ don't exist, then you'll get a "silent fail" in Apache when starting the HTTP server from the EasyPHP console.

VirtualHost on Apache Server -- CentOS

I am new to Apache server and would appreciate any help from you guys regards to VirtaulHost.
Context: I am setting up a CA/Web Server on CentOS 5.8 with Apache Server and I would like to have a public accessibility to my CRL
Network Configurations: eth0 - Private Interface: 10.10.10.2, eth1 - Public Interface: 199.200.201.202 (fake one of course :P)
Current Configuration in "httpd.conf":
<VirtualHost 10.10.10.2:80>
ServerAdmin a#aa.com
DocumentRoot /var/www/html
ErrorLog logs/CA-Test.abc.net
CustomLog logs/CA_Custom_logs common
</VirtualHost>
<Directory />
Order allow, deny
Allow from all
AllowOverride all
</Directory>
URL for CRL Location: "CA-Test.abc.net\ca\crl\root.crl"
Question\Problem: I would like to allow public access to the "\ca\crl" directory only, but not the contents under parent directories "\ca"
Should my VirtualHost Configuration to be:
<VirtualHost 199.200.201.202:80>
ServerAdmin a#aa.com
DocumentRoot /ca/crl/root.crl
ErrorLog logs/CA-Test.abc.net
CustomLog logs/CA_Custom_logs common
</VirtualHost>
If not, What should the correct DocumentRoot to be in this case? (/var/www/html/ca/crl/root.crl??) How should I configure it correctly to allow external access to the correct URL of CRL location?
Thank you for your time and help.. :)
try adding these to your httpd.conf
<VirtualHost IP:80>
DocumentRoot /fullpath/to/ca/crl/
ServerName CA-Test.abc.net
</VirtualHost>
Now restart your httpd and try browsing the url
http://CA-Test.abc.net/root.crl
Now public can't access the contents in the folder "ca". Let us know if that helped you.

Apache NameVirtuaHost does not respect ServerName's

I have an Apache server configured with several configuration files in which I declare VirtualHost's. However, when I access my server for one of the given ServerName it is not respected and defaults to another one.
My configurations is as followed:
In a ports.conf file I have this:
NameVirtualHost *:80
Listen 80
Then in another file, I have this:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName my.server.com
ServerAlias other.server.com
DocumentRoot /home/mys/
Alias / /home/mys/
ErrorLog /var/log/apache2/mys-error.log
<Directory /home/mys/>
Options Includes Indexes FollowSymLinks MultiViews
AllowOverride AuthConfig
Order allow,deny
allow from all
</Directory>
</VirtualHost>
In another file I have this
<VirtualHost *:80>
ServerName something.server.com
ServerAlias else.server.com
Redirect permanent / https://something.server.com
</VirtualHost>
And I have a configuration on port 443 for something.server.com which works ok
When I call http://my.server.com, I end up on https://something.server.com
All hostnames point to the same IP.
I am running on Apache/2.2.9 (Debian)
Any hint or ideas would be much appreciated. I am not an Apache expert so if I need to provide more info or formulate this in another way, just let me know.
OK, actually this is working fine, but because I indicated a Permanent Redirect, Firefox cached the redirect. So nothing wrong in the configuration (although one might say that is probably dangerous to indicate a permanent redirect).