Drupal 7 multisite not working - apache

I am trying to setup a multisite for an existing drupal 7 site.
What I've done is
Created a db and imported the existing sites db to use with the new site
Created a folder inside sites directory called mysite.local and copied settings.ph and changed the db configurations with the new one.
Added an entry in /etc/hosts file.
127.0.0.1 mysite.local
Added a file mysite.local.conf in /etc/apache2/sites-available and added the following lines.
DocumentRoot "/var/www/html/drupal/sites/mysite.local"
ServerName mysite.local
ServerAlias mysite.local
`
and enabled the site.
Then added a symbolic link to this directory
ln -s /var/www/html/drupal /var/www/html/drupal/sites/mysite.local
But I am getting 403 while accessig mysite.local.
Can any one help me to figure out what is going wrong here

Even if it is a multisite you need to point it to the root directory. Drupal will figure out based off the domain name where to pull the settings.php from. Change your DocumentRoot back to /var/www/html/drupal

Related

AWS eb deploy Changes httpd.conf Virtual Hosts Document Root

I run an AWS ElasicBeanstalk Apache server. There is a subdomain with a different DocumentRoot (see below). When I use eb deploy and then ssh into the machine to manually change the /etc/http/conf/httpd.conf file, everything works just fine.
If however I do eb deploy again, the DocumentRoot in the http.conf file changes from "/var/www/html/sub/" to "/var/www/html/", the rest of the file remains unchanged.
I suppose eb deploy must somehow rewrite the httpd.conf file, but I am puzzled as to why only the document root changes.
<VirtualHost *:80>
ServerName example.com
DocumentRoot "/var/www/html/"
</VirtualHost>
<VirtualHost *:80>
ServerName sub.example.com
DocumentRoot "/var/www/html/sub/"
</VirtualHost>
Does anyone have a clue how I can get my subdomains working?
By Elastic Beanstalk functionality, whatever changes we do on the instance(s) manually, it will be reflected only on that instance for temporarily. The changes will be vanished if you reboots/rebuilds the instance.
If you want the changes to be applied permanently on all the instances, then you need to make use of .ebextensions folder with appropriate .config files within the folder. You can specify the configuration changes to the server software (apache, php etc) using the .ebextensions feature.
The .ebextensions folder will be a part of your code .zip file all the times.
You can refer the following link to get more help on .ebextensions:
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/ebextensions.html

How to add a website to the Apache Web Server

I have installed a the following Drupal distribution on an Ubuntu virtual machine at /var/www/html.
https://www.drupal.org/project/social
The Composer script installs the project at /var/www/html/project-folder and index.php can be found in /var/www/html/project-folder/html.
Within the file /etc/apache2/sites-available/000-default.conf I have changed the document root to `/var/www/html/project-folder/html'.
Now when I visit the IP Address for the server, it does load the homepage of the PHP based website, but all of the links to other pages are broken, and none of the images can be found.
What is the correct way to add a new site to the Apache web server? Should a VirtualHost be used, or is it better to change the document root?
/etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html/project-folder/html
</VirtualHost>

laravel right server configuration for host several site

I got a laravel project uploaded on a vps, I can't understand how to configure all things to have:
more than one site(laravel project) on the vps; (that is is tricky, because all configuration examples that i've found talking about pointing the root of the server to the public laravel's folder)
having .env and .composer and all the system folders not accesible directly;
wich are the right user and permission to set on the various folders;
In my system ive :
www-data classic apache group with standard privileges;
a non root user, used even to access to mysql and ftp service;
a root user;
I'm using apache2 over ubuntu server 16.04.
According to the Question, I assume that you want to host multiple Laravel Sites on the VPS without messing anything up!Here we go!
Let's Assume that you create the Directories of your site in /var/www directory because it's where your Basic Apache directory will be.Configuration for Site 1:
->Virtual Host for Site 1
<VirtualHost *:80>
DocumentRoot "var/www/site1/public"
ServerName www.site1.com
# Other directives here
</VirtualHost>
-> Directory for Site 1 (Upload your Project here): /var/www/site1
Configuration for Site 2:
->Virtual Host for Site 2
<VirtualHost *:80>
DocumentRoot "var/www/site2/public"
ServerName www.site2.com
# Other directives here
</VirtualHost>
-> Directory for Site 2 (Upload your Project here): /var/www/site2
Here is the Trick! As Laravel have its index.php file in the Public Folder of the Project, Your Domains will point to /var/www/site-x/public folder for the specific site! They will have their own composer and config files in /var/www/site-x/ directories of their own! So, This is how you can host multiple Laravel sites on the same VPS without messing anything up! I am using the same technique! I think it's the only one trick to do so! Let me know if that works!

New Ubuntu server with Virtual Host show directory instead of website

I'm setting up a new Ubuntu 16.04 server with Apache. I followed this guide to do my setup.
Now when I try to access the site it shows me an empty directory. If I try to access a specific file (index.html) the server doesn't find it. Even trying to see the default website (by accessing my public IP) I get an empty directory.
Here's my .conf file:
ServerAdmin admin#website.com
ServerName website.com
ServerAlias www.website.com
DocumentRoot /var/www/website.com/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
(for the purpose of this public question I changed the name of the site for website.com)
All file's and folder's rights are set to my username as owner and www-data as group. Apache's error log shows nothing wrong and access log is empty.
I banged my head for hours on this issue without any progress so any help is welcome!
Thanks
P.S.: The server is Ubuntu Server 16.04 LTS 64b running on a VirtualBox VM.
Obiviously you have missed out something. Please check that you have
/var/www/example.com/public_html/index.html
with correct spellings.
Also make sure that the config has both index.html and index.php in DirectoryIndex, check this link for more info
If all is correct create a .htaccess file in /var/www/example.com/public_html/
nano /var/www/example.com/public_html/.htaccess file
and then add the followings in it.
DirectoryIndex index.htm index.html index.php

virtualhost keeps redirecting to deleted alias information

I have a DigitalOcean droplet (i.e. a VPS server), with Ubuntu 14.04 and Apache 2.2.
I had 4 virtualhosts configured, with 4 different domains pointing to 4 different folders, no problem.
I needed to point a 5th domain (let's call it www.someshop.tld) containing a PrestaShop installation.
I added the following Alias to the apache2/sites-available/domain1.conf file so that www.domain1.tld/someshop would lead to www/prestashop, and it worked fine
<VirtualHost *:80>
ServerName www.domain1.tld
DocumentRoot /www/directory1
Alias /someshop /www/prestashop #Alias line
</VirtualHost>
I did this as a temporary measure so I could have a working site publicly accessible, (so I could access www/prestashop publicly before I had configured www.someshop.tld DNS settings, 'A' record, Nameservers, etc.).
I now don't need to do this any more, so I deleted the Alias line from the .conf file so it looks like this:
<VirtualHost *:80>
ServerName www.domain1.tld
DocumentRoot /www/directory1
</VirtualHost>
and added a new someshop.conf that looks like this:
<VirtualHost *:80>
ServerName www.someshop.tld
DocumentRoot /www/prestashop
</VirtualHost>
I then re-enabled both the .conf files in apache2/sites-enabled, and restarted apache with service apache2 restart.
However, when I go to www.someshop.tld, it continues to do a URL redirect to www.domain1.tld/prestashop (where there's this message: "Not Found, The requested URL /someshop was not found on this server").
I waited for a couple of hours before posting this question because I thought it might just be a "propagation" issue. So far it's still doing this.
My question: is this something that should clear up by waiting for it, or do I need to fix something else? E.g., is there some way for me to flush the old virtualhost Alias information?
Have you tried removing the site from apache config?
$ sudo a2dissite test.com.conf #Remove symlink
$ sudo service apache2 reload
This would remove the symlink. You can then create the symlink again with the proper configurations that you like.