XAMPP + virtual hosts + group shared folder - apache

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

Related

Apache: forbidden on virtual host

I've
/var/www/app.mydomain.com
This contain only on index.html with
<h1>I want it works ... please</h1>
This is my /etc/apache2/sites-enabled/app-mydomain-com.conf
<VirtualHost *:80>
ServerName app.mydomain.com
ServerAdmin info#mydomain.it
DocumentRoot /var/www/app.mydomain.com
CustomLog ${APACHE_LOG_DIR}/vhosts/app-mydomain-com/access.log vhost_combined
ErrorLog ${APACHE_LOG_DIR}/vhosts/app-mydomain-com/error.log
</VirtualHost>
When I open browser at app.mydomain.com I got a forbidden from apache
In the error.log (the main error.log, NOT the one specific of my vhost) I got
Cannot serve directory /var/www/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,
index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive
I totally have no idea of what does it mean in my case
I tried to add
DirectoryIndex index.html
But nothing changes (after a restart of apache2, of course)
I verified that site was enabled
a2ensite app-mydomain-com
Site app-mydomain-com already enabled
At the end, the problem was only a missing ServerAlias directive.

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?

Unsure of what to add to hosts file - Apache Subdomain

I'm trying to make a subdomain for my xampp/apache hosted website.
However, whenever I attempt to access the subdomain it gives me an "HTTPS insecure error" and redirects me to the main part of the site. Also, I can still access the main site without any issues at all.
In my 'httpd-vhosts.conf' file, I believe all the entries are correct and the issue lies with my hosts file.
To clarify, this is a website with a premium domain name, (i.e not just a website for local use). Most of the tutorials and guides I can find are only really designed for websites that are used locally only.
Here is my 'httpd-vhosts.conf' file (with my domain name edited out of course):
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/"
ServerName domain.xyz
ServerAlias https://domain.xyz
ErrorLog "logs/domain.xyz-error.log"
CustomLog "logs/domain.xyz-access.log" common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/sub1"
ServerName sub1.domain.xyz
ServerAlias https://sub1.domain.xyz
ErrorLog "logs/sub1.domain.xyz-error.log"
CustomLog "logs/sub1.domain.xyz-access.log" common
</VirtualHost>
The entries I have in my hosts file are (which I'm fairly certain is completely wrong):
127.0.0.1 localhost
127.0.0.1 domain.xyz
127.0.0.1 sub1.domain.xyz

Apache document root and VirtualHost

I'm having some problems with setting up a VirtualHost with Apache on CentOS. I'll try my best to explain what happens.
In our httpd.conf file we had to change the Document root, our base is /var/www/mydomain.com but our files is on /var/www/mydomain.com/store2 and when users goto mydomain.com we want them to come directly to mydomain.com/store2
Main config:
DocumentRoot "/var/www/mydomain.com/store2/"
Directory "/var/www/mydomain.com/store2"
So, I've added an config file inside conf.d named subdomains.conf and this is the information inside
<VirtualHost *:80>
ServerAdmin mail#me.com
DocumentRoot /var/www/mydomain.com/subdomain
ServerName subdomain.mydomain.com
ErrorLog logs/subdomain.mydomain.com
CustomLog logs/subdomain.mydomain.com common
</VirtualHost>
When i restart the httpd service and goto mydomain.com I'm transferred to the virtual host root (/var/www/mydomain.com/subdomain) this also happens when i go to subdomain.mydomain.com. Is there something that I'm missing here? Could there be something with the DNS also? I see that mydomain.com and subdomain.mydomain.com points to the same IP-address.

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

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)