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
Related
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?
I have installed the open source status page Cachet on my macbook's local web server and it works perfectly but during the set up it tells you to change your apache's virtual host to route all traffic to Cachet. I am trying to allow Cachet to run by going to the main domain but if I go to domain/test I would like it to go to another web page. I tried adding another vhost like this:
<VirtualHost *:80>
ServerName http://domain/test
DocumentRoot /Users/macbook/Sites/
</VirtualHost>
but this does not work, I just get error 404 when trying to reach /test page.
Cachet is built using the Laravel framework, so there is a front controller in the public/ directory. That's why you need to route all the requests to this file. But you do not need to route all the traffic of your server to Cachet, that's just the traffic of the site (Cachet), in order to /setup and others are executed by /public/index.php.
Your vhost file may be simple, below an example of what it could be.
It is a simple vhost configured in Mamp, on OSX.
<VirtualHost *:80>
DocumentRoot "/Applications/MAMP/htdocs/Cachet/public"
ServerName status.mysite.com
<Directory /Applications/MAMP/htdocs/Cachet/public>
AllowOverride All
</Directory>
</VirtualHost>
The routing to the public/index.php file is performed by a .htaccess file, so you don't have to write this configuration in your vhost. All you need to do in your vhost is to allow the .htaccess execution.
Note for local web server
If you want to use a custom domain name, you'll need to
update the /etc/hosts file to match the domain with your loopback IP
address.
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
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.
I just followed the instructions from this page (http://www.alexkorn.com/blog/2011/03/getting-php-mysql-running-amazon-ec2/) to setup apache and mysql on an ec2 instance. I couldn't get their custom file structure to point to my files, so I changed the structure to /var/www/html and change changed the bottom of the http.conf file to show this change. When I do that, I get an Amazon Linux AMI Test Page test page on the server, but when I try to test /index.html or /index.php, I get a file not found error - even though I created the /var/www/html directories and placed both files there - what can I be doing wrong?
Page location: http://ec2-107-20-234-28.compute-1.amazonaws.com/
It based on the Linux OS and how Apache has been setup, as per your statement, it looks you have configured the <VirutalHost> something similar to below (correct me if I am wrong):
<VirtualHost *>
ServerName localhost
DocumentRoot /var/www/html
</VirtualHost>
Then, you restarted Apache (? - confirm), if this is correct, then I am sure you see what you want.
Update:
If you are using Debian/Ubuntu don't mind looking at the following URL for configuring an OS for web-development: http://rakesh.sankar-b.com/2010/09/10/install-setup-debian-os-server-machine/