Symfony not loading up in EC2 instance AWS - symfony

I have a symfony website on digital ocean droplet, i am trying to migrate symfony website to aws ec2 instance. This is the tutorial i have followed : Deploy Symfony on Ubunut 14.04
I have followed each and every step according to the tutorial and have installed composer and other prerequisites needed. Here is the sites-available default config file for apache on my server :
<VirtualHost *:80>
ServerName miscellani.co
ServerAdmin info#miscellani.co
DocumentRoot /var/www/miscellani/web
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
But even after setting all the parameter files and everything apache is not loading up the correct index for the file but showing directories.
Output image
I have tried multiple tutorials but all showing the same output for symfony. If anyone can help me out here where i am doing it wrong or which file i need to install or redo any step it will be highly appreciated. Thank you.
Update :
Made changes as recommended by Jan but its still giving me the same parent directory rather than the website.

1st add to /etc/hosts:
127.0.0.1 localhost
127.0.0.1 miscellani.co
127.0.0.1 www.miscellani.co
Run in shell
sudo cp 000-default.conf miscellani.conf
edit miscellani.conf
Correct VirtualHost for Symfony is (miscellani.conf):
<VirtualHost *:80>
ServerName miscellani.co
ServerAlias www.miscellani.co
DocumentRoot /var/www/miscellani/web
<Directory /var/www/miscellani/web >
AllowOverride All
Order Allow,Deny
Allow from All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
When add file run in shell command:
sudo a2enmod rewrite
sudo a2ensite miscellani
sudo service apache2 restart

Related

I cannot get Vhost to host multiple wordpress websites on centos 6.8

Issue: I cannot make the webserver host multiple websites.
Solutions I have tried:
I made two different Vhost.conf for the different websites(named differently according the website name but with the .conf extension. I then targeted different document roots linked to the websites within these config files. – Failed, displayed “connection refused”
I then went to the second website directory I created and change the file permissions to 755 (and 777 just incase) to check if that was conflicting and creating the issue, this also failed and made the same error.
Also all files have “chown -R root:root dir/ “ on.
I then went on to open port 8080 in iptables and changed the targeted port in the vhost of the second website to 8080, this also failed with the same error.
I tried finding the second website using “ip:8080, ip/secondwebsitedirectory, ip:80/secondwebsitedirectory” none of these worked. I followed each step of multiple tutorials online and none of these worked.
When I tested just making a directory and displaying the <?php phpinfo; ?> in index.php within the directory, then targeting that with the document root of the first virtual host block, this worked but did not display the second block’s website (I used the domain to link the alias to this and forwarded the domain to the servers ip).
My current vhost.conf file looks like this **NOTE: I removed ip’s and domains on clients request. They do work and have been tested so that isn’t an issue. Anything with “testsite” was originally the clients domain. **
I have made it two separate VirtualHost blocks previously and had the same result as I am having currently, I have had <VirtualHost *:80> on both blocks too.
<VirtualHost *>
ServerAdmin webmaster#testsite.org
ServerName ea
ServerAlias *server ip was here*
DocumentRoot /var/www/html/ea
ErrorLog /var/www/html/ea/logs/error.log
CustomLog /var/www/html/ea/logs/access.log combined
ServerAdmin webmaster#testsite.org
ServerName testsite
ServerAlias www.testsite.co.uk
DocumentRoot /var/www/html/testsite/public_html
ErrorLog /var/www/html/testsite/logs/error.log
CustomLog /var/www/html/testsite/logs/access.log combined
</VirtualHost>
The end result I want to come to is to be able to host multiple sites on my cloud server, these website are using Wordpress as that is the development platform I have been instructed to use and the server is running Centos 6.8 with all php and apache2 installed and working on one website.
As to a conclusion to this, I am stumped and need your help.
You need one statment for each site you want
<VirtualHost ea.mydomain.com:80>
ServerAdmin webmaster#testsite.org
ServerName ea.mydomain.com
ServerAlias ea
DocumentRoot /var/www/html/ea
<Directory "/var/www/html/ea/">
Options FollowSymLinks Indexes
AllowOverride None
# Use require all granted for apache 2.4
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/www/html/ea/logs/error.log
CustomLog /var/www/html/ea/logs/access.log combined
</VirtualHost>
<VirtualHost testsite.mydomain:80>
ServerAdmin webmaster#testsite.org
ServerName testsite.mydomain
ServerAlias testsite.mydomain testsite
DocumentRoot /var/www/html/testsite/public_html
<Directory "/var/www/html/testsite/public_html">
Options FollowSymLinks Indexes
AllowOverride None
# Use require all granted for apache 2.4
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/www/html/testsite/logs/error.log
CustomLog /var/www/html/testsite/logs/access.log combined
</VirtualHost>

How to configure apache to serve directory for custom domain

Currently, I have configured a domain I bought through GoDaddy to point to the elastic ip address of my personal ec2 instance. I'm having issues finding the correct solution to configure my httpd.conf such that my custom domain, example.com points to a specific subdirectory var/www/Example. Further, I want to be able to still access my other projects and sites by simply typing in the elastic ip and subdirectory.
I have tried the using a virtual host with the following configuration..
<VirtualHost *:80>
ServerAdmin webmaster#example.com
DocumentRoot "/var/www/html/Example/wordpress"
ServerName fitnessfifteen.com
ErrorLog "logs/example.com-error_log"
CustomLog "logs/example.com-access_log" common
</VirtualHost>
When I do this, I can access the correct content by going to www.example.com however, I'm unable to access my other files and projects via 11.11.111.111/OtherProjectDirectory (I get that default internal server error page). I'm completely new to this sort of stuff so many this isn't possible and I have a fundamental misunderstanding.
Add another virtual host to http.conf as below and restart apache.
<VirtualHost *:80>
ServerAdmin webmaster#example.com
DocumentRoot "/var/www/html/Example/wordpress/OtherProjectDirectory"
ServerName 11.11.111.111
ErrorLog "logs/example.com-error_log"
CustomLog "logs/example.com-access_log" common
</VirtualHost>

wordpress forbidden 403 error

After installing wordpress and following all the steps when I am go to http://localhost, I am gettong 403 Forbidden error.
How can I resolve this?
Ubuntu 14.04 is my OS.
In normal case changing permission and updating .htaccess should fix this issue, but in your case it is not working, so try to create a host entry and see if it is working. Else it will be related to the server configuration.
a. Create a new folder inside /var/www (example: wordpress - with proper permissions)
b. Copy all files from /var/www/html folder to /var/www/wordpress
c. Create a virtual host entry: sudo gedit /etc/apache2/sites-available/wordpress.conf
Add following contents:
<VirtualHost *:80>
ServerName wordpress
DocumentRoot /var/www/wordpress
<Directory /var/www/wordpress>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
</VirtualHost>
d. Update hosts: sudo gedit /etc/hosts
Add new line: 127.0.1.1 wordpress
e. Activate new website: sudo a2ensite wordpress.conf
d. Restart apache: sudo service apache2 restart
Access http://wordpress from your web browser.

Can't find deployed app

I deployed my first meteor app on a digital-ocean droplet using mup. So it's there but I can't figure out what I still have to setup to actually view my app. So when I go to www.example.com I should see it but all I see is an apache page.
When you start a Meteor app, you can specify the port for it to listen on using the --port argument. For it to be available from at you domain name specify port 80. Though if you have Apache listening on that port already it will fail to bind to it. Uninstall or stop Apache, and restart your Meteor app.
If you are using Apache to serve other content and can not stop it, you'll need to have your Meteor run on a different port with an Apache ProxyPass. First enable mod_proxy and mod_proxy_http
sudo a2enmod proxy proxy_http
Then create a new VirtualHost for the Meteor app that proxies request to the port you have decided to have it listen on. It will look something like:
<VirtualHost *:80>
ServerName www.example.com
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
See this article for all the details.

OSX Mavericks Apache Added Virtualhost Loads Localhost instead

Been working on a locahost VHost setup for a WordPress Roots development environment with Bedrock including Composer, Capistrano and WP CLI using Homebrew on my OSX Mavericks Mac Mini all morning. I am using Homebrew's PHP 5.5 and MySQL 5.6.19 and OSX's Apache. Thought I had sort of understood Apache VirtualHost inner workings, but I am missing something.
I added img.local to /etc/hosts
127.0.0.1 localhost img.local
255.255.255.255 broadcasthost
::1 localhost img.local
fe80::1%lo0 localhost img.local
and have this in /etc/apache2/extra/httpd-vhosts.conf:
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
DocumentRoot "/Library/WebServer/Documents"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
ServerAdmin jasper#img.local
DocumentRoot "/Users/jasperfrumau/webdesign/img/web"
ServerName img.local
ServerAlias www.img.local
ErrorLog "/private/var/log/apache2/img.local-error_log"
CustomLog "/private/var/log/apache2/img.local-access_log" common
<Directory "/Users/jasperfrumau/webdesign/img/web/">
Option FollowSymlinks
AllowOverride All
Order allow, deny
allow from all
</Directory>
</VirtualHost>
I restarted the server using apachectl -k restart as root after I checked the config using apachectl -S . It said I was all good:
apachectl -S
VirtualHost configuration:
Syntax OK
When I load img.local in my browser the root localhost is loaded. So either my img.local is still bypassed because of a faulty vhosts file or there is something else in /etc/apache2/httpd.conf I need to change. What am I missing or doing wrong here?
In the end I realised the /etc/apache2/httpd.conf was loading the vhosts from /private/etc/apache2/other/*.conf so I added one img.conf there and restarted the server. There were some errors in the file after all once it was read. This is the correct one:
<VirtualHost *:80>
ServerAdmin jasper#img.local
DocumentRoot "/Users/jasperfrumau/webdesign/img/web"
ServerName img.local
ServerAlias www.img.local
ErrorLog "/private/var/log/apache2/img.local-error_log"
CustomLog "/private/var/log/apache2/img.local-access_log" common
<Directory "/Users/jasperfrumau/webdesign/img/web/">
Options FollowSymlinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>

Resources