I just installed LAMP on Ubuntu 14.04 LTS and created virtual host for Symfony project. I didn't change anything in the Symfony project yet but already as I try to load AcmeDemoBundle I get error An error occured while loading the web debug toolbar (404: Not found). Do you want to open profiler?
I did some research but all I found is to do something with .htaccess file which didn't work. I have some suspicions that it might be my virtual host conf file in /etc/apache2/sites-enabled/ the content of that file is:
<VirtualHost *:80>
ServerAdmin admin#localhost
ServerName registration.dev
ServerAlias www.registration.dev
DocumentRoot /var/www/registration/web/
DirectoryIndex app_dev.php
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
I had the same issue. Here a working file for your /etc/apache2/sites-enabled/
<VirtualHost *:80>
ServerName test.dev
DocumentRoot /var/www/html/test_symfony/web/
DirectoryIndex app_dev.php
<Directory "/var/www/html/test_symfony/web/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
Order allow,deny
allow from all
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /app_dev.php [QSA,L]
</IfModule>
</Directory>
The following url: http://test.dev/home will direct you to the home page without the debug toolbar. To make sure you got the tool bar specify the app_dev.php : http://test.dev/app_dev.php/home
hope it helps
Related
I have Bitnami LAMP stack running on AWS. I have installed Wordpress in a folder called /wordpress/ using a downloaded Bitnami installer. It is visible publicly through the url: 11.11.111.11/wordpress/. I have set up an A Record for a domain name to point to the IP address. The result is that the site now is visible through the URL: mydomain.com/wordpress/.
Problem is that I want it to be visible via the url: mydomain.com (without the /wordpress/ folder).
I have tried everything that I have found on the topic for 2 days and simply cannot solve this seemingly simple task. I'm happy to provide more info on request. Please can someone help!
EDIT
I have the following two Apache configuration files:
opt/bitnami/apps/wordpress/conf/httpd-vhosts.conf
with content:
<VirtualHost *:80>
ServerName mydomain.com
ServerAlias www.mydomain.com
DocumentRoot "/opt/bitnami/apps/wordpress/htdocs"
Include "/opt/bitnami/apps/wordpress/conf/httpd-app.conf"
</VirtualHost>
<VirtualHost *:443>
ServerName mydomain.com
ServerAlias www.mydomain.com
DocumentRoot "/opt/bitnami/apps/wordpress/htdocs"
SSLEngine on
SSLCertificateFile "/opt/bitnami/apps/wordpress/conf/certs/server.crt"
SSLCertificateKeyFile "/opt/bitnami/apps/wordpress/conf/certs/server.key"
Include "/opt/bitnami/apps/wordpress/conf/httpd-app.conf"
</VirtualHost>
opt/bitnami/apps/wordpress/conf/httpd-app.conf
with content:
RewriteEngine On
RewriteRule /<none> / [L,R]
<IfDefine USE_PHP_FPM>
<Proxy "unix:/opt/bitnami/php/var/run/wordpress.sock|fcgi://wordpress-fpm" timeout=300>
</Proxy>
</IfDefine>
<Directory "/opt/bitnami/apps/wordpress/htdocs">
Options +MultiViews +FollowSymLinks
AllowOverride None
<IfVersion < 2.3 >
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3>
Require all granted
</IfVersion>
<IfDefine USE_PHP_FPM>
<FilesMatch \.php$>
SetHandler "proxy:fcgi://wordpress-fpm"
</FilesMatch>
</IfDefine>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [S=1]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
</Directory>
Include "/opt/bitnami/apps/wordpress/conf/htaccess.conf"
The result is that mydomain.com (registered at Godaddy) points to the root and not the wordpress directory.
My understanding of Apache is that vhosts allows you to point a domain to a document root folder and have multiple domains pointing to a single server IP address. So I don't see why this does not work.
I found the solution. Maybe this can help someone.
Do not use the /opt/bitnami/apps/wordpress/conf/httpd-vhosts.conf config file, but instead use the /opt/bitnami/apps/wordpress/conf/httpd-prefix.conf and run the following command:
sudo /opt/bitnami/apps/wordpress/bnconfig --appurl /
i started new project on symfony 2.8.2.
I added on my apache2 sites/enabled this vhost file, copied from symfony cookbook:
<VirtualHost *:80>
ServerName local.n-difference.fr
ServerAlias local.n-difference.fr
DocumentRoot /var/www/n-difference/web
<Directory /var/www/n-difference/web>
AllowOverride None
Order Allow,Deny
Allow from All
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>
</Directory>
# uncomment the following lines if you install assets as symlinks
# or run into problems when compiling LESS/Sass/CoffeeScript assets
# <Directory /var/www/project>
# Options FollowSymlinks
# </Directory>
# optionally disable the RewriteEngine for the asset directories
# which will allow apache to simply reply with a 404 when files are
# not found instead of passing the request into the full symfony stack
<Directory /var/www/project/web/bundles>
<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>
</Directory>
ErrorLog /var/log/apache2/errors.log
</VirtualHost>
I did sudo service apache2 restart to refresh the server.
I access the project from another Dev PC with ssh, and of course, i added on this etc/hosts file:
192.168.1.20 local.n-difference.fr
The problem is when i try to access the url local.n-difference.fr, i have this www/ index page
Did i forget something ?
Thank's a lot for your help :)
(and sorry for my bad english)
I can't for the life of me figure out getting Wordpress to work with pretty permalinks on my Apache server. I've searched online and tried a myriad of combinations of things. The URL in question is www.trixiebangbang.com. I have a traditional LAMP stack running on Ubuntu all hosted with AWS.
I want the Wordpress "Day and Name" permalinks working. I have already selected that in Wordpress and updated my .htaccess file and given it 755 permissions:
# .htaccess file
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
That still results in a 404 error when I view my blog posts. For example if I go to this example blog post it doesn't work. I then updated my /etc/apache2/sites-enabled/000-default.conf configuration file to be the following:
# 000-default.conf file
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
<Directory />
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
I am very careful and sure to execute "sudo service apache2 restart" after every change I make before testing. Can someone please tell me what's wrong here? Thanks in advance.
After more searching I was able to piece together a solution that worked for me. I updated the 000-default.conf file to the following and restarted the server. I hope this helps someone else.
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName trixiebangbang.com
DocumentRoot /var/www/html
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
I am new to server deployment and I have recently deployed my symfony website to a ubuntu based server. In order to run my website without specification of app.php I added DirectoryIndex app.php in my apache conf so my website is visible on www.abc.com however any other link is not working;
for example the link below does not work
www.abc.com/route
Any help will be highly appreciated!
If you are on ubuntu and have root access, try adding this virtualhost into /etc/apache2/apache2.conf
<VirtualHost *:80>
ServerName abc.com
ServerAlias abc.com
ErrorLog /var/log/httpd/abc.com.log
DocumentRoot /var/www/html/abc.com/web/
<Directory /var/www/html/abc.com/web/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /app.php [QSA,L]
</IfModule>
</Directory>
</VirtualHost>
tried almost anything but i cannot get it to work
I have wordpress installation on my root folder and another installation on a subdirectory.
I have been trying to use mod_rewrite to divert all traffic coming to a sub domain to the sub directory where the other installation is.
basically i want to divert traffic coming from ads.mydomain.com to www.mydomain.com/ads (without redirecting and changing the url)
I have been using this rewrite rule
RewriteEngine On
Options Indexes FollowSymlinks Multiviews
RewriteCond %{REQUEST_URI} !^/ads/
RewriteCond %{HTTP_HOST} ^(.+)\.mydomain\.com
RewriteCond %{HTTP_HOST} !^www\.mydomain\.com
RewriteRule ^(.*)$ /ads/$1 [L]
it is working fine except that calling ads.mydomain.com/wp-admin redirects me to the main domain (www.mydomain.com/wp-admin) ...
what is wrong here ?
solved using
<VirtualHost *:80>
ServerName ads.domainname.com
ServerAlias www.ads.domainname.com
DocumentRoot /opt/bitnami/apps/wordpress/htdocs/ads
</VirtualHost>
<VirtualHost *:80>
ServerName domainname.com
ServerAlias domainname.com
ServerAlias www.domainname.com
DocumentRoot /opt/bitnami/apps/wordpress/htdocs
</VirtualHost>
on httpd.conf