I am encountering a very strange behaviour with Apache 2 that I cant seem to solve. Essentially I have a domain, lets call it domain1.
http://domain1.ovh points to the correct folder.
http://www.domain1.ovh points to the folder of another website I am hosting with Apache 2. (Which is not intended, both addresses are supposed to point to the same folder and show the same page.)
I cant seem to find a way to fix this problem. I apologize if you find this question to be a repeat but I read all the suggested questions and none helped me.
Here is my Apache 2 configuration file:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName celtiberianproductions.ovh
ServerAlias celtiberianproductions.ovh www.celtiberianproductions.ovh
DocumentRoot /var/www/celtiberianproductions.ovh
<Directory />
AllowOverride All
</Directory>
<Directory /var/www/celtiberianproductions.ovh>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require all granted
</Directory>
ErrorLog /var/log/apache2/celtiberianproductions.ovh-error.log
LogLevel error
CustomLog /var/log/apache2/celtiberianproductions.ovh-access.log combined
</VirtualHost>
I must also add that in my domain provider control panel I am pointing both domain1.ovh and www.domain1.ovh to the IP address of the VPS machine I have with an A link.
Your Apache 2 configuration seems OK but your domain names point to different ip addresses:
https://toolbox.googleapps.com/apps/dig/#A/domain1.ovh
;QUESTION
domain1.ovh. IN A
;ANSWER
domain1.ovh. 3599 IN A 51.254.133.96
https://toolbox.googleapps.com/apps/dig/#A/www.domain1.ovh
;QUESTION
www.domain1.ovh. IN A
;ANSWER
www.domain1.ovh. 3598 IN A 213.186.33.5
Related
I've recently been migrating a small website on a VPS from a rudimentary and static one to the Flask framework, via WSGI/Apache2. However, while access to the website is functional when accessing from a browser using the IP address, use of the domain name brings the standard and nonspecific Apache2 message "The requested URL was not found on this server." My VHost is as follows:
<VirtualHost *:443>
ServerName slow.estate
ServerAlias www.slow.estate
ServerAdmin my.email#gmail.com
WSGIScriptAlias / /var/www/se/se.wsgi
<Directory /var/www/se/se/>
Order allow,deny
Require all granted
</Directory>
Alias /static /var/www/se/se/static
<Directory /var/www/se/se/static/>
Order allow,deny
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
I've tried this both with the VHost set to port 80 (and, of course, with SSLify disabled) and with SSL and port 443, with no difference. The problem also persists no matter if I use Apache's older Allow from all or the newer Require all granted in my VHost. In the VHost above, the website will not work at all. If I modify the ServerName to be the IP address, then it works exclusively when that IP address is entered into the browser. Each time I try and fail to use the website in the above manner, a relevant entry is made in access.log, and no entry is made in error.log.
I've only found one other person out there with a similar problem to me, and that seemed just to be that their nonstandard TLD was being misinterpreted by their browser, which is why I mention that my TLD is .estate. I doubt, surely, that this could be the issue, especially when this issue, unlike the other person's, plagues me across browsers?
I'm having a lot of trouble setting up a local website that I need to do some work on.
I have 2 local sites: "first_training" and "resus_skills"
The former, first_training, works. I have it set up that first_training.loc/ takes me to the local site. resus_skills is set up in the exact same way, but when I try to access resus_skills.loc/ all I get is:
Here are the details of my setup, as well as some screenshots of it:
/etc/apache2/sites-available/resus_skills.conf :
<VirtualHost *:80>
ServerName resus_skills.loc
ServerAlias www.resus_skills.loc
DocumentRoot "/var/www/resus_skills"
<Directory "/var/www/resus_skills">
Options Indexes FollowSymLinks MultiViews
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
I made sure to enable it with sudo a2ensite resus_skills.conf and have confirmed that it's symlink is present in ``/etc/apache2/sites-enabled`
I've made sure my apache server is running:
and I've run apachectl -S to get this result:
I am able to reach first_training.loc/ with no issues, but cannot reach resus_skills.loc/.
I'm unsure how to troubleshoot this - the apache error.log isn't showing me anything.
Before anyone points out what an idiot I've been - I never updated the /etc/hosts file, which was the only missing step.
I'm trying to place a domain alias named noetic.dev, I'm having a fresh laravel installation in the htdocs folder named noetic.
For achieving this I tried to change httpd.conf file and added this:
Alias /noetic.dev "F:/xamp/htdocs/Noetic/public/"
<Directory "F:/xamp/htdocs/Noetic/public/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require local
</Directory>
and I changed following in httpd-vhosts.conf:
<VirtualHost *:8082>
ServerName noetic.dev
DocumentRoot c:/wamp/www/NitsEdit/public
</VirtualHost>
and similarly I've in the hosts file:
127.0.0.1 noetic.dev
Now while trying the link to be as http://localhost:8082/noetic.dev/ I'm getting the result but while trying noetic.dev:8082 I'm getting an error
Access forbidden:
You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.
If you think this is a server error, please contact the webmaster.
I don't know where I'm doing wrong, guide me in this.
For Vhost you have wrong path of C:/
DocumentRoot c:/wamp/www/NitsEdit/public
that should be
DocumentRoot F:/xamp/htdocs/Noetic/public/
I struggle with apache's virtual host configuration. I want to deploy cgit on a subdomain like: http://cgit.mydomain.com
I have used this as a template for my configuration: http://hjemli.net/pipermail/cgit/2011-July/000235.html
Here is my virtual host configuration:
<VirtualHost *>
ServerAdmin admin#mydomain.org
ServerName cgit.mydomain.org
ErrorLog "/var/log/httpd/cgit-error_log"
CustomLog "/var/log/httpd/cgit-access_log" common
DocumentRoot "/usr/share/webapps/cgit/"
<Directory "/usr/share/webapps/cgit/">
AllowOverride None
Options ExecCGI FollowSymlinks
Order allow,deny
Allow from all
</Directory>
Alias /cgit.css "/usr/share/webapps/cgit/cgit.css"
Alias /cgit.png "/usr/share/webapps/cgit/cgit.png"
Alias /favicon.ico "/usr/share/webapps/cgit/favicon.ico"
ScriptAlias / "/usr/share/webapps/cgit/cgit.cgi/"
</VirtualHost>
Here is a part of my cgitrc:
css=/cgit.css
logo=/cgit.png
favicon=/favicon.ico
Everything works fine but the css file and the favicon do not work, so the cgit webpage is broken. When I go to the URL http://cgit.mydomain.com/cgit.css cgit tells me that there is no repo called cgit.css. Usually I shoud see the cgit.css file in my browser.
A possible solution is to use /cgit/ as a script alias but I do not want to have the /cgit/ fragment in my URLs. On http://cgit.osmocom.org it works right.
I am note really shure why but now the setup works! After adding DocumentRoot "/usr/share/webapps/cgit/" to my virtual host I stopped working yesterday.
Today I looked on my cgit website and everything is fine! I think it was something like a cache issue...
The virtual host settings above work.
I am trying to make a setup so that I can access my website on a virtual host in computer A from computer B. Both A and B are on the same network.
I am using xampp on Win 7.
So here is as the problem goes computer A(server) has a virtual host configuration as follows in the httpd-vhosts.conf file.
NameVirtualHost project:81
<VirtualHost project:81>
DocumentRoot "D:/work/website"
ServerName project:81
<Directory "D:/work/website">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
(using port 81 as port 80 has IIS running, dont know much about these things however)
this configuration works fine on the local machine(server). i.e project:81 in the address bar of the browser opens up the website as it should.
Now on computer B(client) I changed the hosts file to contain the IP of the server along with the name of the virtual host like:-
192.168.1.7 project
now when I enter project:81 on the client browser .. it takes me to the server but its not taking me to the virtual host directory, instead it takes to the default directory .. i.e in my case is
C:\xampp\htdocs
Now I am stuck and unable to make the client to point to the current destination.
So can anybody suggest what I am doing wrong here or something else I need to do in order to have access to the correct virtual host site from the client machine.
Thanks in advance for any help
Ok So Seto El Kahfi's reply to my very old question led me to do some more research and reading on Apache's website.
So what I got is this, my NameVirtualHost directive was improper.
So Instead of this,
NameVirtualHost project:81
<VirtualHost project:81>
DocumentRoot "D:/work/website"
ServerName project:81
<Directory "D:/work/website">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
What I had to do was this.
NameVirtualHost *:81
<VirtualHost *:81>
DocumentRoot "D:/work/website"
ServerName project
<Directory "D:/work/website">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
Notice the ' * ' , I could have used an IP Address there too.(In this case my server's(machine A) local IP) both work. Now all I had to do is enter "project:81" on the client machine, and I get what my eyes wished to see.. :)
Few things I got from this.
1) How to use NameVirtualHost(or what it's purpose basically is.). Read More here
http://httpd.apache.org/docs/2.2/mod/core.html#namevirtualhost
This one is also good http://www.thegeekstuff.com/2011/07/apache-virtual-host/
2)You can use this via command line:
httpd -D DUMP_VHOSTS
to know how your virtual hosts are setup(will also give you some warnings regarding precedence if something's wrong with your setup)
3)Other's gesture to help you makes you help yourself.. :) So keeping helping and rocking.
Have you try to include the port at your client host's file?
192.168.1.7:81 project