Apache: 3 virtual hosts working perfectly, 1 is not, but settings seem to be the same (Mac) - apache

(OSX Leopard 10.5.8)
I've been using virtual hosts with no problems until now, when I tried to make a new block of code for the next one. The offender is called project1.
I've got an index.php sitting in the project1/html/ folder, just like all the others. But every time I try to go to http://project1/ in the browser I get a 404.
Here's the contents of httpd-vhosts.conf:
<VirtualHost *:80>
ServerName localhost
DocumentRoot "/Users/sebu/_SERVER/"
</VirtualHost>
<VirtualHost *:80>
ServerName skeleton
DocumentRoot "/Users/sebu/_SERVER/skeleton/public_html/"
</VirtualHost>
<VirtualHost *:80>
ServerName pickle
DocumentRoot "/Users/sebu/_SERVER/pickle/"
</VirtualHost>
<VirtualHost *:80>
ServerName project1
DocumentRoot "/Users/sebu/_SERVER/project1/html/"
</VirtualHost>
Here's what I've checked already:
I restarted Apache (every time I change something).
I tried clearing the browser cache.
I tried rebooting.
I made sure the file permissions are exactly the same as the other working vhosts (dirs and files).
I've got the line Options Indexes +FollowSymLinks -MultiViews in httpd.conf (turning Multiviews off was the solution to an earlier problem).
I ran httpd -S to check the syntax and it said everything was OK.
I tried pinging project1 just to check and sure enough it says cannot resolve project1: Unknown host
(Not sure if it's worth mentioning, but when I did a ls -la in _SERVER/ I noticed that project1/ had permissions written as drwxr-xr-x# with the # on the end. I read that this meant it was a quarantined file and would wait for me to open it so I ran open project1/ and it went away.)

do you have an entry in /etc/hosts for skeleton, pickle, but not project1? If so, add an entry for project1 and that should resolve your issue.

Related

XAMPP Virtual Host cant find?

I'm trying to set up a local development environment for a PHP project. The project is placed in the htdocs folder, and i wanna be able to access it on a virtual host environment so all the links and so on works, and treats it as the root directory.
So, here is what i have done:
C:\Windows\System32\drivers\etc
hosts
127.0.0.1 bakeboss.test
C:\xampp\apache\conf\extra
httpd-vhosts
<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs\bakeboss"
ServerName bakeboss.test
<Directory "C:\xampp\htdocs\bakeboss">
</Directory>
</VirtualHost>
Apache starts up fine, but if i try to go to (in my browser):
www.bakeboss.test
NOTHING happens - cannot find it, cannot connect. If i go to localhost/bakeboss it works, but obviously not the way i want it.
What am i missing here?

Apache2 keeps redirecting to default page

I've installed some software for users to be able to change their ldap password on they own named self service password on this path: /usr/share/self-service-password/htdocs.
In sites-enabled my configuration is as follows: (file named 000-default.conf)
<VirtualHost *:80>
ServerName <IP>
DocumentRoot /usr/share/self-service-password/htdocs
DirectoryIndex index.php
AddDefaultCharset UTF-8
LogLevel warn
ErrorLog /var/log/apache2/ssp_error.log
CustomLog /var/log/apache2/ssp_access.log combined
</VirtualHost>
(same thing is "configured" at sites-available").
I've made sure this .conf file (000-default) is enabled by a2ensite, and made sure everything else is disabled, and restarted apache2.
However, When browsing to my IP:81 , it keeps redirecting me to Apache default welcome page under /var/www/html .
I'm trying to find a solution for it for the past 2 hours and couldn't find the reason behind it.
Thanks for anyone willing to assist.
As per your configuration your VirtualHost is accepting connections on port *:80
<VirtualHost *:80>
But then you are testing on IP:81.
Could you please adjust your test to IP:80
or
Adjust the VirtualHost port to *:81
They must match to work.

Localhost redirect to different project folder

I am working in a prestashop project.
Operating System: Linux Mint 19.1
CMS: prestashop
The problem came today, when I cloned my production site to my local machine.
It was not the first time I cloned this project. Actually, I have in:
/var/www/html
different directories:
pre_prestashop pre_magento etc
Now as I said, I copied from production real live website, to local machine in a new directory within /var/www/html
I called it:
dev_prestashop
Everything was perfect, and I can see when I type localhost in my browser every project/directory:
pre_prestashop
pres_magento and
=> dev_prestashop
The fact is, when I try to access locahost/dev_prestashop it makes a redirect to my old directory localhost/pre_prestashop (pre_prestashop works and local site is OK, but it is my OLD local site and not dev_prestashop).
I've been googling but none is experiencing this issue.
I check my /etc/apache2/sites-available and see:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
ServerName localhost
ServerAlias pre_calleja
ServerAlias dev_prestashop
<Directory /var/www/html/>
Options +FollowSymlinks
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
I verified every single filed in database, and deleted .htaccess file from root directory in dev_prestashop...
I can't understand what is happening.
Actually, If I comment pre_prestashop to _pre_prestashop and change dev_prestashop to pre_prestashop, everything works perfectly, so problems is not in dev_prestashop.
I would apreciate very much help to understand this problem, more than solve it because now I am working in renamed folder.
Thanks.

VirtualBox Ubuntu 16.04 apache2 vhost jumping to https or not showing the page

I am trying to set up some vhosts on a Virtual Box with Ubuntu 16.04 Apache2 PHP 7.0 to start moving the code to PHP7.
I have moved the v-host file from the older VBox which looked like this
<VirtualHost 192.168.2.174:80>
ServerName admin.ubuntu16.de
ServerAlias admin.ubuntu16.de
ServerAdmin email#company.de
DocumentRoot /home/www/public_html/workspace/admin
php_value auto_prepend_file '/home/www/public_html/workspace/admin/administration/conf/register_globals.php'
<Directory /home/www/public_html/workspace/admin>
Options Indexes FollowSymLinks MultiViews ExecCGI
Options All
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
But it kept on trying to load the page with https or saying that there is no access to site root folder
These settings work perfectly on Ubuntu 14 Virtuall Box with apache2 and PHP 5.5.something
So I followed the tutorial and changed it to simply
<VirtualHost 192.168.2.174:80>
ServerName admin.ubuntu16.de
ServerAlias admin.ubuntu16.de
ServerAdmin email#company.de
DocumentRoot /home/www/public_html/workspace/admin
</VirtualHost>
But now it just jumps straight to https mode
I obviously ran a2ensite
I also switched off the default site by running "a2dissite 000-default.conf"
I also enable modules to do with proxying and a bunch of others while getting appache to actuallly start :-)
Any ideas on things I might off missed are greatly appreciated.
Just a little edit:
All the files for the sites are situated on the main Windows machine and are imported through /media/sf-workspace
The symbolic link is then created as /home/www/public_html/workspace
I would first eliminate the symbolic links and just make a copy of all the files inside the virtual box to remove that variable.
Apache can be screwy with symlinks.

vhosts dont appear to be working on OS X Mavericks Apache installation

I am trying to set up the Apache server which comes with OS X Mavericks with vhosts so that a domain name resolves to my user level document webroot. I have followed this tutorial which guided me through setting up the apache server with php:
http://coolestguidesontheplanet.com/get-apache-mysql-php-phpmyadmin-working-osx-10-9-mavericks/
as well as this one which guided me through setting up the vhosts:
http://coolestguidesontheplanet.com/set-virtual-hosts-apache-mac-osx-10-9-mavericks-osx-10-8-mountain-lion/
Following these tutorials, if I type localhost in my browser it correctly resolves to the system level root (/Library/WebServer/Documents/ folder). If I use localhost/~myusername it correctly resolves to my user level root (/users/myusername/Sites/).
However, whenever I navigate to my domain, I get redirected to the system level root rather than my user level root.
My vhosts file reads as follows:
<VirtualHost *:80>
ServerName localhost
DocumentRoot /Library/WebServer/Documents/
</VirtualHost>
<VirtualHost *:80>
ServerName mydomain.com
ServerAlias www.mydomain.com
DocumentRoot "/Users/myusername/Sites/mydomain"
<Directory "/Users/myusername/Sites/mydomain">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
Any ideas?
Have you enabled Virtualhosts?
NameVirtualHost *:80
And included your vhosts directory
Include <path>/vhosts/*
On a Macbook, you may need to include /private/ at the beginning of any absolute path, so that Apache can read it correctly off the file system.
For others who have the same problem...
It was frustratingly simple - I had missed the "" around the localhost directory.
How annoying!
Try starting apache manually with the -S option to see what the problem might be:
/usr/sbin/httpd -S