I'm starting to learn symfony for php framework and I got problem with httpd.conf configuration.
First, I have xampplite installed on my windows c:\xampplite\
and then I created a symfony project (as described on getting started guide)
c:\xampplite\htdocs\symfonytest\
Everything works fine when I tried to access http://localhost/symfonytest/web/
(all icons and text are displayed pretty well)
Now I got to configure the httpd.conf and I type like this:
<VirtualHost 127.0.0.1/symfonytest>
DocumentRoot "c:\xampplite\htdocs\symfonytest\web"
DirectoryIndex index.php
<Directory "c:\xampplite\htdocs\symfonytest\web">
AllowOverride All
Allow from All
</Directory>
Alias /sf c:\xampplite\htdocs\symfonytest\web\sf
<Directory "c:\xampplite\htdocs\symfonytest\web\sf">
AllowOverride All
Allow from All
</Directory>
But it has no effect at all ... when I type http://127.0.0.1/symfonytest/ it still displayed directory list of my c:\xampplite\htdocs\symfonytest\
How to solve this httpd.conf problem?
Thank you !!!
You can't do that using a VirtualHost. Instead, use an Alias:
Alias /symphonytest/ "c:\xampplite\htdocs\symfonytest\web"
<Directory "c:\xampplite\htdocs\symfonytest\web">
AllowOverride All
Allow from All
</Directory>
Alias /sf/ c:\xampplite\htdocs\symfonytest\web\sf
<Directory "c:\xampplite\htdocs\symfonytest\web\sf">
AllowOverride All
Allow from All
</Directory>
This should work as you're expecting it to.
Related
Laravel installation on XAMPP only shows pages in /public. When i try to go a page like /business/register which is in /resources. I get a 404 page. I've set the vhosts file on XAMPP properly. The code is below.
I've tried almost everything and even checked .htaccess. Couldn't find the problem.
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/pos"
ServerName pos.dev
<Directory "C:/xampp/htdocs/pos">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Allow from all
Require all granted
</Directory>
</VirtualHost>
With this config, it should work
check to make sure that there is .htaccess in you public folder
DocumentRoot "C:/xampp/htdocs/pos/public"
<Directory "C:/xampp/htdocs/pos/public">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Allow from all
Require all granted
</Direcroty>
i recommended using homestead https://laravel.com/docs/5.7/homestead
I am running a CentOS 6.9 OS. I have Apache/2.2.15 (CentOS) Server running. I have a cakephp 2 application that I want to run here. I have an index.php file inside /var/www/html that runs perfectly. I have another folder called test inside /var/www/html.
Inside that folder there is an index.php file. Test folder also runs perfectly. But whenever I try to run the cakephp application from the browser I get the message I don't have permission to access that folder. The cakephp application has 0777 permission. Inside my /etc/httpd/conf/httpd.conf file there is written -
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
So I don't know what I am doing wrong and what more I can do.
hi dude please find and edit httpd.conf file, which is in /etc/httpd/conf/httpd.conf. and paste the code below
<Directory "/">
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride None
Allow from all
</Directory>
<Directory "/home/">
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride None
Allow from all
</Directory>
Then kindly restart the server if the problem still appear
disable the seLinux in /etc/selinux/config change SELINUX=disabled and restart the server it again hope it works now ^_^
restorecon -r /var/www/html does the job
I got the answer from here. https://www.centos.org/forums/viewtopic.php?t=6834
I have a Mac OSX El Capitan operating system. Since my laptop has limited space, I am trying to set up a local server on my 1TB external hard drive with the url http://media.database/, and that uses PHP. I have set it up the best I know how, but when I go to the page, it says "Forbidden You don't have permission to access /index.php on this server."
I have set apache and host files as best I know how, but I'm still pretty new to this sort of thing. I have listed my updates to those files below and restarted the apache server using sudo apachectl restart, which has gotten me this far. Can someone enlighten me on what I might be missing. All help is greatly appreciated.
/etc/apache2/httpd.conf
<VirtualHost *:80>
ServerName media.database
DocumentRoot "file:///Volumes/DBTARA/media/"
<Directory "file:///Volumes/DBTARA/media/">
DirectoryIndex index.php index.html
AllowOverride all
Options -MultiViews
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
/etc/hosts
127.0.0.1 media.database
/etc/apache2/users/vmbmacintosh.conf
<Directory "file:///Volumes/DBTARA/media/">
AllowOverride All
Options Indexes MultiViews FollowSymLinks
Require all granted
</Directory>
/etc/apache2/httpd.conf
I attempted to add the following DocumentRoot after the one I already have, but that made my other local servers inaccessible and kept the external one as forbidden.:
DocumentRoot "file:///Volumes/DBTARA/media"
<Directory "file:///Volumes/DBTARA/media">
Options FollowSymLinks Multiviews
MultiviewsMatch Any
AllowOverride None
Require all granted
</Directory>
Thanks again in advance for any assistance.
Now I've searched and played around cannot get my head around what is going on.
I am unable to install a local webserver (XAMPP or w/e) onto this laptop, so I am hoping to have a play with Laravel 4 directly on my dedicated box.
I have a Linux box (Debian) with Apache, Composer and PHP 5.4.4 installed. Plenty of other websites up and running on this.
I have installed Laravel 4, via Composer directly into a directory: public_html/dev/
Apache is set-up so the sub-domain dev.mydomain.com points to this directory.
Going to dev.mydomain.com, or dev.mydomain.com/public/ (anything in-fact) gives me a 403 Forbidden error.
My apache config file:
<VirtualHost (my ip)>
ServerAdmin webmaster#localhost
ServerName dev.mydomain.com
DocumentRoot /home/user/public_html/dev
Options -Indexes -FollowSymLinks -MultiViews
</VirtualHost>
I've tried chmod 777 to public, the document root to /home/user/public_html/dev/public but with no luck.
Unless I'm missing the point of something here, or some security problem (since working on a live server isn't great) then please tell me, I'm probably being a noob.
Try this
<VirtualHost *:80>
DocumentRoot /home/user/public_html/dev/public
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/user/public_html/dev/public/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
You had -FollowSymLinks, and i assume this applies to also the rewrite rule that comes default with laravel. (.htaccess file) removing the -Follosymlinks would have fixed it for you too i presume.
I am trying to install PHP-Laravel in Windows 8 and I am using Xamp server(localhost). I am following Installing Laravel guide.
According to this guide I am making virtual host using following code :
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/TssApp/public"
ServerName TssApp
<Directory "C:/xampp/htdocs/TssApp/public">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
</Directory>
</VirtualHost>
//Where "C:/xampp/htdocs/TssApp/public" is path of Laravel public folder
and I have also added following line in in etc/hosts
127.0.0.2 TssApp
After doing necessary steps mentioned in this tutorial when I type "http://TssApp" , it always redirect to "http://tssapp/xampp/" instead of Laravel Home page. I don't know if I am missing any thing.
Note: I can access laravel home page at "http://localhost/tssapp/public/" but want
to use "http://TssApp" link to access my application.
Please help me regarding this issue.
Thanks .
Do you have NameVirtualHost * in your virtual-hosts configuration?
You'll need to restart Apache after any changes to either /etc/hosts or your virtual-hosts configuration files
Try adding the code to C:\xampp\apache\conf\extra\httpd-vhosts.conf instead of adding it to your own conf file. As far as I know xampp will ignore it unless its in the vhosts file.
You could try this.
<VirtualHost *>
DocumentRoot "C:\xampp\htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *>
DocumentRoot "C:\xampp\htdocs\TssApp\public"
ServerName tssapp
<Directory "C:\xampp\htdocs\TssApp\public">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Although you should put your files in the xampp directory and not the htdocs directory, so your files should be C:\xampp\TssApp\public, This would stop people from visiting htdocs which is a public folder and getting access to your application.
According to the documentation (that you point to), you should write
<VirtualHost 127.0.0.2>
and not
<VirtualHost *:80>
Could you try that and restart your computer/server?
Add in:
Allow from all
after
AllowOverride all
The end result should be:
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/TssApp/public"
ServerName TssApp
<Directory "C:/xampp/htdocs/TssApp/public">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Allow from all
</Directory>
</VirtualHost>
Also make sure you are editing the file "httpd-vhosts.conf" found in:
C:\xampp\apache\conf\extra