WAMP Using PostgreSQL + Drupal 7 + Multisite + CleanURLs - Not working - apache

As the title suggests I am trying to run multiple local development sites on WAMP using Postgresql...I have tried so many combinations and none work.
I have 3 sites that correspond to live productions sites so clean-urls is key...
site1.example.com
site2.example.com
site3.example.com
I installed Drupal7 in a local folder on my harddrive at c:\CM\Web\fooproject
I created a hard-link in WAMP at c:\wamp\www\fooproject to c:\CM\Web\fooproject
I edited "sites.php" in the drupal fooproject\sites directory to look like below:
$sites['localhost.site1.example.com'] = 'site1.example.com';
$sites['localhost.site2.example.com'] = 'site2.example.com';
$sites['localhost.site3.example.com'] = 'site3.example.com';
I added the following to my local PCs hosts file:
127.0.0.1 localhost.site1.example.com
127.0.0.1 localhost.site2.example.com
127.0.0.1 localhost.site3.example.com
I connect to the sites in the browser, e.g. - for site1 at:
"http://localhost/site1.example.com"
I created a database in PostgreSQL called "site1drupal"
I enabled the rewrite module in WAMP
Alias /site1.example.com "c:/wamp/www/fooproject/"
<Directory "c:/wamp/www/fooproject/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
</Directory>
I edited the ".htaccess" file in the drupal directory c:/wamp/www/fooproject/ to rewrite the base directory as follows:
# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
# RewriteBase /drupal
#
# If your site is running in a VirtualDocumentRoot at http://example.com/,
# uncomment the following line:
RewriteBase /fooproject
I edited the httpd.conf file on WAMP Apache --> http.conf to include the Virtual hosts directory:
<VirtualHost *:80>
ServerAdmin site1#dummy-host.example.com
DocumentRoot "c:/wamp/www/fooproject/"
ServerName site1.example.com
ServerAlias localhost.site1.example.com
ErrorLog "c:/wamp/logs/site1-error.log"
CustomLog "c:/wamp/logs/site1-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin site2#dummy-host.example.com
DocumentRoot "c:/wamp/www/fooproject/"
ServerName site2.example.com
ServerAlias localhost.site2.example.com
ErrorLog "c:/wamp/logs/site2-error.log"
CustomLog "c:/wamp/logs/site2-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin site1#dummy-host.example.com
DocumentRoot "c:/wamp/www/fooproject/"
ServerName site1.example.com
ServerAlias localhost.site1.example.com
ErrorLog "c:/wamp/logs/site1-error.log"
CustomLog "c:/wamp/logs/site1-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin site3#dummy-host.example.com
DocumentRoot "c:/wamp/www/fooproject/"
ServerName site3.example.com
ServerAlias localhost.site3.example.com
ErrorLog "c:/wamp/logs/site3-error.log"
CustomLog "c:/wamp/logs/site3-access.log" common
</VirtualHost>
I copied the "default" folder in the sites directory and created 3 new folders called "site1.example.com", "site2.example.com" and "site3.example.com"
I am able to install the site fine and navigate to localhost/site1.example.com/?q=admin/config/search/clean-urls and enable clean urls
BUT the result is that it takes me to an "Internal Server error" page if I click link outside of the homepage :(
The error log says the following:
[Thu Feb 13 17:56:14.108803 2014] [core:error] [pid 5268:tid 1636] [client 127.0.0.1:57100] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: http://localhost/site1.example.com/
[Thu Feb 13 17:56:14.109805 2014] [core:debug] [pid 5268:tid 1636] core.c(3518): [client 127.0.0.1:57100] AH00122: redirected from r->uri = /site1.example.com/admin/config, referer: http://localhost/site1.example.com/
I am sure it is a simple fix but I just can't see it ..too many moving parts. Any help would be appreciated :D

Okay I figured this out ...
1st) I needed to remove the aliases I created using WAMP because they were only good if I had multiple INSTALLS of drupal (like testing different versions) ..have nothing to do with Multiple sites!
2) You set-up Vhosts for each site using the actual site name... e.g.
ServerName = site1.example.com
3) You edit the sites.php file to link what you put in your web-browser (localhost.site1.mwdworks.com => site1.mwdworks.com)
4) You add in your computer hosts file the site name you will put in the web-browser (for local development purposes - this can be any name as long as it matches what you put in sites.php ...)
e.g.
127.0.0.1 localhost.site1.example.com
and viola ...this all works well ...just follows these instructions and you are good)

Related

Cannot serve directory /var/www/html/: No matching DirectoryIndex

I'm sure this question has been asked and answered, but I'm not finding a solution. I have a virtual host I have just added SSL to, and it isns't working as expected. The non-SSL version is working properly. Below is what I've got in httpd.conf:
<VirtualHost mysite.com:443>
ServerAdmin email#myemail.com
ServerName mysite.com
ServerAlias www.mysite.com
DocumentRoot /var/www/html/www.mysite.com
<Directory /var/www/html/www.mysite.com>
DirectoryIndex index.html index.htm index.php
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>
SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/my.crt
SSLCertificateKeyFile /etc/pki/tls/private/my.key
</VirtualHost>
The error I'm getting is:
[Thu Jan 11 12:29:58.984354 2018] [autoindex:error] [pid 19998] [client
IP:38470] AH01276: Cannot serve directory /var/www/html/: No matching
DirectoryIndex (index.html,index.php) found, and server-generated directory
index forbidden by Options directive
Obviously, I've got the directory set as /var/www/html/www.mysite.com, but it's trying to serve content directly from /var/www/html.
I'm sure this is something simple, but my brain is already oatmeal from working on this site all day, so I'm probably just failing to see what's right in front of my face.
Thanks!
Fixed it. Simple enough, as I assumed. Change:
<VirtualHost mysite.com:443>
To:
<VirtualHost *:443>

Apache 2.2 - You don't have permission to access site on this server

Hello I am using Server version: Apache/2.2.22 running Ubuntu 12.04.5 . I had my website on another server which was running correctly with 750 permissions to whole folder. When I moved to the new server :
I created the virtual host and I turned it on (a2ensite, reload and restart apache)
<VirtualHost *:80>
ServerAdmin webmaster#example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /path/to/project/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
I set permissions of the project folder to 750 and I get the error :
(13)Permission denied: /path/to/project/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
I cleared .htaccess file but I got the same error. SELinux is not installed and my httpd.conf file is empty. Any ideas?

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.

Configure MAMP to treat each directory in Htdocs as Root in Apache mod_redirect

The issue is that when using MAMP for local development, the .htaccess file needs to differ in that the RewriteBase needs to specify the subdirectory for the specific site (as shown here on SO).
Is there a way to configure MAMP MAMP/conf/apachehttpd.conf so that each virtual site gets it's own "root"?
UPDATE
After getting a clue about Virtual Hosts:
Have updated /etc/hosts file to include:
127.0.0.1 ClientSite.localhost
Uncommented the line:
`#Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf`
in /Applications/MAMP/conf/apache/httpd.conf.
There is a directory called ClientSite in /Users/myname/Sites/.
This is the /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf content:
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host.example.com
ServerName localhost
ServerAlias *.localhost
VirtualDocumentRoot /Users/myname/Sites/%0
RewriteLogLevel 3
RewriteLog "/Applications/MAMP/logs/rewrite.log"
<Directory /Users/myname/Sites>
Options All
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Restarted the MAMP servers (and even ran dscacheutil -flushcache).
When browser is pointed to ClientSite.localhost it returns a 404: The requested URL / was not found on this server.
so that each virtual site gets it's own "root"?
You need to use VirtualDocumentRoot.
This is how I am using this on my MAMP in my /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf file:
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host.example.com
ServerName localhost
ServerAlias *.localhost
VirtualDocumentRoot /Users/admin/htdocs/%0
RewriteLogLevel 3
RewriteLog "/Applications/MAMP/logs/rewrite.log"
<Directory /Users/admin/htdocs>
Options All
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Take note of VirtualDocumentRoot /Users/admin/htdocs/%0 directive. That makes each virtual site's root as:
VirtualDocumentRoot /Users/admin/htdocs/localhost
VirtualDocumentRoot /Users/admin/htdocs/dev.localhost
VirtualDocumentRoot /Users/admin/htdocs/client2.localhost
etc.
Then simply create a directory within /Users/admin/htdocs/ for each site named as above, like:
dev.localhost
client2.localhost
Remove (or rename) any .htaccess files during the process - and once websites confirmed to be accessible via url like: http://client2.localhost, .htaccess files should behave as expected.
Also be sure that in the /etc/hosts file, there's an entry like:
127.0.0.1 client2.localhost
for each URL in question.

XAMPP + virtual hosts + group shared folder

I have folder which mount for all users which in group 'common' for sharing files
/home/.common/ mounted to /home/common by fstab
bindfs#/home/.common /home/common fuse group=common,perms=g=rwx
I want to share sites folders too. I put sites to dir /home/common/Sites/
and made virtual host to those directories. But i'm having error on enter.
on http://mysite/
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.
Error 403
in httpd.conf
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
in httpd-vhosts.conf
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /home/common/Sites/mysite
ServerName mysite
ErrorLog /home/common/Sites/mysite/mysite.local-error_log
CustomLog /home/common/Sites/mysite/mysite.local-access_log common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /home/common/Sites/mysecondsite
ServerName mysecondsite
ErrorLog /home/common/Sites/mysecondsite/mysecondsite.local-error_log
CustomLog /home/common/Sites/mysecondsite/mysecondsite.local-access_log common
</VirtualHost>
in .local-error_log
[error] [client 127.0.0.1] (13)Access denied: access to / denied
When i turn on vhosts - localhost returns error too. If turn off LH works good.
How to make this structure?
The problen was in permissions. I was need to change apache user and group in opt/lampp/etc/httpd.conf