In a fresh installation of Symfony 3, the debug toolbar not showing, when I have the apache 2.4.7 configuration file:
<VirtualHost *:80>
ServerAdmin info#enterprise.cl
ServerName dev.enterprise.cl
#ServerAlias www.domain.tld
DocumentRoot /var/www/html/gestion/web
DirectoryIndex app_dev.php
# uncomment the following lines if you install assets as symlinks
# or run into problems when compiling LESS/Sass/CoffeScript assets
# <Directory /var/www/html/gestion>
# Options FollowSymlinks
# </Directory>
ErrorLog /var/log/apache2/project_error.log
CustomLog /var/log/apache2/project_access.log combined
</VirtualHost>
If I change the configuration file to:
<VirtualHost *:80>
ServerAdmin info#enterprise.cl
ServerName dev.enterprise.cl
# ServerAlias www.domain.tld
DocumentRoot /var/www/html/gestion/web
# DirectoryIndex app_dev.php
# uncomment the following lines if you install assets as symlinks
# or run into problems when compiling LESS/Sass/CoffeScript assets
# <Directory /var/www/html/gestion>
# Options FollowSymlinks
# </Directory>
ErrorLog /var/log/apache2/project_error.log
CustomLog /var/log/apache2/project_access.log combined
</VirtualHost>
And access: http://dev.enterprise.cl/app_dev.php, all going ok.
What is wrong?
Your web directory (in apache config) should be:
<Directory /var/www/html/gestion/web>
Presuming that 'gestion' is you Symfony3 (is it Symfony3?) folder...
A quick verify (the way it is now) is try:
http://dev.enterprise.cl/web/app_dev.php
By the way, are you using a web browser on the same host? If not you'll need to edit the app_dev.php file like so:
if (isset($_SERVER['HTTP_CLIENT_IP'])
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|| !(in_array(#$_SERVER['REMOTE_ADDR'], ['192.168.40.208', '192.168.255.99',
'127.0.0.1', 'fe80::1', '::1']) || php_sapi_name() === 'cli-server')
) {
Where that ['REMOTE_ADDR'] contains the IP of your host; by default it's just localhost (127.0.0.1).
Thank a lot, the solution is uncomment the directive Directory:
<VirtualHost *:80>
ServerAdmin info#enterprise.cl
ServerName dev.enterprise.cl
# ServerAlias www.domain.tld
DocumentRoot /var/www/html/gestion/web
# DirectoryIndex app_dev.php
# uncomment the following lines if you install assets as symlinks
# or run into problems when compiling LESS/Sass/CoffeScript assets
<Directory /var/www/html/gestion>
Options FollowSymlinks
</Directory>
ErrorLog /var/log/apache2/project_error.log
CustomLog /var/log/apache2/project_access.log combined
</VirtualHost>
Alvin, yes I have configure app_dev, to access remotaly, thanks
Related
I am trying to make to move to use Ubuntu for developing. I am working on an exciting Laravel project that is due to go live at the end of the month. I have cloned the repro and now trying to set up a virtual host ( my understanding is that you need this for the site work properly locally ). I have followed this video: https://www.youtube.com/watch?v=lkLAJd-Wb80&t=6s. But all I am getting is a 404 page not found. Hope someone can help with this.
<VirtualHost *:80>
<Directory /var/www/html/myapp/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ServerName myapp.test
ServerAdmin info#myapp
DocumentRoot /var/www/html/myapp/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
I have also added myapp to the hosts file.
You missed the public directory while defining the path in <Directory>. It should be something like this:
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin info#myapp
ServerName myapp.test
ServerAlias myapp.test
DocumentRoot /var/www/html/myapp/public
<Directory /var/www/html/myapp/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
Require all granted
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
Hope this helps you.
Could you try with listening to 80 port like below?
Listen 80
<VirtualHost *:80>
<Directory /var/www/html/myapp/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ServerName myapp.test
ServerAdmin info#myapp
DocumentRoot /var/www/html/myapp/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
My virtual host configuration is like bellow where I used 8080 port.
Listen 8080
<VirtualHost *:8080>
ServerAdmin info#gmail.com
DocumentRoot "D:/appinstall/htdocs/www/app-test-server/public"
ServerName localhost
ErrorLog "logs/app-test-server.log"
CustomLog "logs/app-test-server.log" common
</VirtualHost>
first I copy 000-default.conf
cp 000-default.conf demo
then I link demo in site-avaible
ln -s ../sites-available/demo demo
here is my 000-default.conf I want to set project run in www.example.com
<VirtualHost *:80>
ServerName example.com
ServerAlias demo.example.com/
DocumentRoot /var/www/html/test/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combin
</VirtualHost>
here is my demo file I want to project run in demo.example.com
<VirtualHost *:80>
ServerName www.example.com
DocumentRoot /var/www/html/main/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/html/main/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
after that I run service apache2 restart I can enter in www.example.com only but I cant enter to demo.example.com . I'm not sure what I'm doing wrong
So a few minor things I feel the need to say - First, I would always leave .conf on copied files. Second, I would always use a2ensite and a2dissite to enable and disable any sites.
I would also disable the default site in this case if you are using the example.com domain name. If your default site is not currently enabled, that would be why you can't access demo.example.com - if you're looking to access that site, you'll need to enable it by running a2ensite 000-default
Help set up a virtual host. In the file /etc/apache2/httpd.conf I uncommented this line here:
# Virtual hosts
Include /private/etc/apache2/extra/httpd-vhosts.conf
Next, the file is opened, and in the end ordered a new virtual host:
<VirtualHost *:80>
ServerName localhost
DocumentRoot "/Library/WebServer/Documents/"
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot "/Users/igor/sites/advanced"
ServerName advanced
ErrorLog "/private/var/log/apache2/lab.domain-error_log"
CustomLog "/private/var/log/apache2/lab.domain-access_log" common
<Directory "/Users/igor/sites/advanced/">
Options Indexes MultiViews
AllowOverride All
Allow from all
Require all granted
</Directory>
</VirtualHost>
Then added to the hosts 127.0.0.1 advanced. Restart Apache, but the browser displays a 403 error! What could it be?
My goal is two have two versions of Magento installed in my Sites/ folder. One is the current version we are using (1.12), and the other is the upgraded version (1.14). There are several reasons why I need to do this.
Another developer upgraded Magento and sent over the site files, which I put in Sites/magento2.dev, and I also have the working original in Sites/magento1.dev.
I created a separate database, imported the dump from the upgraded version, and put this in the local.xml file for magento2:
<host><![CDATA[localhost]]></host>
<username><![CDATA[root]]></username>
<password><![CDATA[mypassword]]></password>
<dbname><![CDATA[mydatabase]]></dbname>
<active>1</active>
Then I went into the database and changed the core_config_data base urls for our three websites to mimic what I had set on the older version:
http://www.magento2.dev/
http://www.magento2-b.dev/
http://www.magento2-c.dev/
I updated my /etc/apache2/extra/httpd-vhosts.conf file:
# Virtual Hosts
# Note: You also need to edit the hosts file /private/etc/hosts
NameVirtualHost *:80
#magento1.dev / Magento 1.12
<VirtualHost *:80>
ServerAdmin myuser#mywebsite.com
DocumentRoot "/Users/myuser/Sites/magento1.dev"
<Directory "/Users/myuser/Sites/magento1.dev">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ServerName magento1.dev
ErrorLog "/private/var/log/apache2/magento1.dev-error_log"
CustomLog "/private/var/log/apache2/magento1.dev-access_log" common
</VirtualHost>
#magento-b.dev / Magento 1.12
<VirtualHost *:80>
ServerAdmin myuser#mywebsite.com
DocumentRoot "/Users/myuser/Sites/magento1.dev"
ServerName magento1-b.dev
ErrorLog "/private/var/log/apache2/magento1-b.dev-error_log"
CustomLog "/private/var/log/apache2/magento1-b.dev-access_log" common
</VirtualHost>
#magento-c.dev / Magento 1.12
<VirtualHost *:80>
ServerAdmin myuser#mywebsite.com
DocumentRoot "/Users/myuser/Sites/magento1.dev"
ServerName magento1-c.dev
ErrorLog "/private/var/log/apache2/magento1-c.dev-error_log"
CustomLog "/private/var/log/apache2/magento1-c.dev-access_log" common
</VirtualHost>
#magento2.dev / Magento 1.14
<VirtualHost *:80>
ServerAdmin myuser#mywebsite.com
DocumentRoot "/Users/myuser/Sites/magento2.dev"
ServerName magento2.dev
ErrorLog "/private/var/log/apache2/magento2.dev-error_log"
CustomLog "/private/var/log/apache2/magento2.dev-access_log" common
</VirtualHost>
#magento2-b.dev / Magento 1.14
<VirtualHost *:80>
ServerAdmin myuser#mywebsite.com
DocumentRoot "/Users/myuser/Sites/magento2.dev"
ServerName magento2-b.dev
ErrorLog "/private/var/log/apache2/magento2-b.dev-error_log"
CustomLog "/private/var/log/apache2/magento2-b.dev-access_log" common
</VirtualHost>
#magento2-c.dev / Magento 1.14
<VirtualHost *:80>
ServerAdmin myuser#mywebsite.com
DocumentRoot "/Users/myuser/Sites/magento2.dev"
ServerName magento2-c.dev
ErrorLog "/private/var/log/apache2/magento2-c.dev-error_log"
CustomLog "/private/var/log/apache2/magento2-c.dev-access_log" common
</VirtualHost>
I updated my /private/etc/hosts file:
127.0.0.1 localhost
127.0.0.1 www.magento1.dev
127.0.0.1 www.magento1-b.dev
127.0.0.1 www.magento1-c.dev
127.0.0.1 www.magento2.dev
127.0.0.1 www.magento2-b.dev
127.0.0.1 www.magento2-c.dev
I have tried a few other iterations of this (adding trailing slashes, http, www, etc), always with the same result. When I go to www.magento2.dev, www.magento2-b.dev, or www.magento2-c.dev, I get a slightly different version (fonts broken) of my old version of the site (www.magento1.dev), but with the new URL. Logging into the backend, I can see that it is 1.12, and the URL changes to the older version. Basically it seems like I just made three new local domains for the old version of the primary store website.
I've restarted apache and mysql about a million times.
I should also note that if I got to http://localhost/~myuser/magento2.dev, I get a 403 notice.
What am I missing here?
First, match the ServerName in your httpd.conf with the corresponding domains you added in your local hosts file. Also try viewing the logs i realtime when you visit any of the urls in your browser.
$ cd /private/var/log/apache2/
$ tail -f magento1-b.dev-error_log
You can also tail all the log files at once to see which vhost gets a hit when visiting any of the localhost host file domains in your browser.
$ cd /private/var/log/apache2/
$ tail -f *.log
Also, test if the vhost's are working by creating a simple .php file in Magento root and visit it with your browser. For example, create /Users/myuser/Sites/magento1.dev/info.php with the following content:
<?php
echo gethostname() . "\n";
echo getcwd() . "\n";
?>
Visit http://www.magento1.dev/info.php
Visit http://www.magento2.dev/info.php
Verify local hosts file (Mac)
127.0.0.1 www.magento1.dev
127.0.0.1 www.magento1-b.dev
127.0.0.1 www.magento1-c.dev
127.0.0.1 www.magento2.dev
127.0.0.1 www.magento2-b.dev
127.0.0.1 www.magento2-c.dev
Otherwise, use this as a minimum httpd.conf (with matching ServerName. This currently works in my local MAMP environment.)
NameVirtualHost *
<VirtualHost *>
DocumentRoot "/Users/myuser/Sites/magento1.dev"
ServerName www.magento1.dev
ErrorLog "/Users/myuser/Sites/magento1.dev-error_log"
CustomLog "/Users/myuser/Sites/magento1.dev-access_log" common
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Users/myuser/Sites/magento1.dev"
ServerName www.magento1-b.dev
ErrorLog "/Users/myuser/Sites/magento1-b.dev-error_log"
CustomLog "/Users/myuser/Sites/magento1-b.dev-access_log" common
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Users/myuser/Sites/magento1.dev"
ServerName www.magento1-c.dev
ErrorLog "/Users/myuser/Sites/magento1-c.dev-error_log"
CustomLog "/Users/myuser/Sites/magento1-c.dev-access_log" common
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Users/myuser/Sites/magento2.dev"
ServerName www.magento2.dev
ErrorLog "/Users/myuser/Sites/magento2.dev-error_log"
CustomLog "/Users/myuser/Sites/magento2.dev-access_log" common
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Users/myuser/Sites/magento2.dev"
ServerName www.magento2-b.dev
ErrorLog "/Users/myuser/Sites/magento2-b.dev-error_log"
CustomLog "/Users/myuser/Sites/magento2-b.dev-access_log" common
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Users/myuser/Sites/magento2.dev"
ServerName www.magento2-c.dev
ErrorLog "/Users/myuser/Sites/magento2-c.dev-error_log"
CustomLog "/Users/myuser/Sites/magento2-c.dev-access_log" common
</VirtualHost>
If you have working vhost's, then check the index.php & .htaccess files within each copy of Magento for any hard-coded domain or store code occurrences.
I am getting an 403 access forbidden when attempting to open a page under a vhost where the document root is sitting on a different drive than where apache is sitting. I installed using the apachefriends release. This is my httpd-vhosts.conf file:
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
ServerName foo.localhost
DocumentRoot "C:/xampp/htdocs/foo/public"
</VirtualHost>
<VirtualHost 127.0.0.1>
ServerName bar.localhost
DocumentRoot "F:/bar/public"
</VirtualHost>
When opening bar.localhost in my browser, Apache is giving me 403 Access Forbidden. I tried setting lots of different access rights, even full rights to everyone, but nothing I tried helped.
Edit: Thanks! For future reference, add 'Options indexes' within to show directory indexes.
You did not need
Options Indexes FollowSymLinks MultiViews Includes ExecCGI
AllowOverride All
Order Allow,Deny
Allow from all
Require all granted
the only thing what you need is...
Require all granted
...inside the directory section.
See Apache 2.4 upgrading side:
http://httpd.apache.org/docs/2.4/upgrading.html
Somewhere, you need to tell Apache that people are allowed to see contents of this directory.
<Directory "F:/bar/public">
Order Allow,Deny
Allow from All
# Any other directory-specific stuff
</Directory>
More info
For Apache 2.4.2: I was getting 403: Forbidden continuously when I was trying to access WAMP on my Windows 7 desktop from my iPhone on WiFi. On one blog, I found the solution - add Require all granted after Allow all in the <Directory> section. So this is how my <Directory> section looks like inside <VirtualHost>
<Directory "C:/wamp/www">
Options Indexes FollowSymLinks MultiViews Includes ExecCGI
AllowOverride All
Order Allow,Deny
Allow from all
Require all granted
</Directory>
I have fixed it with removing below code from
C:\wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf file
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host.example.com
DocumentRoot "c:/Apache24/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host2.example.com
DocumentRoot "c:/Apache24/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>
And added
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot "c:/wamp/www"
ServerName localhost
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
</VirtualHost>
And it has worked like charm
Solved 403: Forbidden when visiting localhost. Using ports 80,443,3308 (the later to handle conflict with MySQL Server installation)
Windows 10, XAMPP 7.4.1, Apache 2.4.x My web files are in a separate folder.
httpd.conf - look for these lines and set it up where you have your files, mine is web folder.
DocumentRoot "C:/web"
<Directory "C:/web">
Changed these 2 lines.
<VirtualHost *:80>
ServerAdmin webmaster#localhost.com
DocumentRoot "C:/web/project1"
ServerName project1.localhost
<Directory "C:/web/project1">
Order allow,deny
allow from all
</Directory>
</VirtualHost>
to this
<VirtualHost *:80>
ServerAdmin webmaster#localhost.com
DocumentRoot "C:/web/project1"
ServerName project1.localhost
<Directory "C:/web/project1">
Require all granted
</Directory>
</VirtualHost>
Add your details in your hosts file
C:\Windows\System32\drivers\etc\hosts file
127.0.0.1 localhost
127.0.0.1 project1.localhost
Stop start XAMPP, and click Apache admin (or localhost) and the wonderful XAMPP dashboard now displays! And visit your project at project1.localhost