I got a MAC. I installed XAMPP as I did in Windows. It works. But how do I change the htdocs folder to the SDcard?
I opened the Applications/XAMPP/xamppfiles/etc/httpd.conf
found the DirectoryRoot line
Tried to change as follow:
<Directory "/Volumes/SDcard/xampp/htdocs">
<Directory "/SDcard/xampp/htdocs">
both settings keep showing "Access forbidden!"
but the folder info said "You can read and write"
then I add a symbolic link in Applications/XAMPP/
ln -s /Volumes/SDcard/xampp/htdocs ./htdocs-sdard
and change the httpd.conf again
<Directory "/Applications/XAMPP/xamppfiles/htdocs-sdcard">
it does not work either. same error page
Any ideas?
I also want to change the MySQL folder to SDcard too..... :(
I just found I need to change DocumentRoot too.
DocumentRoot "/Volumes/SDcard64G/xampp/htdocs"
<Directory "/Volumes/SDcard64G/xampp/htdocs">
Now it works
Related
hi I have many sites that I want to test on local, so when I edit the files on auto virtual host files under Apache->sites-enabled->file name, after reloading laragon, the file resets to its original default contents, ex-
Original
<VirtualHost *:80>
DocumentRoot "C:/laragon/www/cast.see.tech/public"
ServerName cast.see.tech.test
ServerAlias *.cast.see.tech.test
<Directory "C:/laragon/www/cast.see.tech/public">
AllowOverride All
Require all granted
</Directory>
edited
<VirtualHost 192.168.1.101:80>
DocumentRoot "C:/laragon/www/cast.see.tech/public"
ServerName cast.see.tech.test
ServerAlias *.cast.see.tech.test
<Directory "C:/laragon/www/cast.see.tech/public">
AllowOverride All
Order Deny,Allow
Allow from all
Require all granted
</Directory>
I cannot save any rules, any code, it comes back to its default original content once I restart laragon server. I am using windows 11, but the same problem I face on windows 10 also.
I tried uninstalling and installing back, but still no luck. Currently i am using latest version of laragon 5.0.0 210523, I also tried downgrading the version but still the same problem. Is it a windows issue or do I need to do something else. Please help me with this issue.
Each project has each own Virtual Host file located in:
For Apache:
{LARAGON_ROOT}\etc\apache2\sites-enabled\auto.{project}.test.conf
For Nginx:
{LARAGON_ROOT}\etc\nginx\sites-enabled\auto.{project}.test.conf
Content of a .conf file is auto generated. If you have a specific project which has modified content, just remove the auto. prefix from config file names eg : auto.example.test.conf => example.test.conf , Laragon will keep the content of the .conf file intact.
Virtual Host content is configurable, you can change it by modifying the template in:
{LARAGON_ROOT}\usr\tpl\VirtualHost.tpl
https://laragon.org/docs/pretty-urls.html
Laragon uses a template to auto-generate the virtual hosts.
On windows, the file is located at C:\laragon\usr\tpl\VirtualHost.tpl, assuming you installed it in C:\laragon.
Just edit this file and make the changes you want.
Keep in mind that all your sites will now use the same configurations.
One change I personally make is to remove the *. from ServerAlias, as I use subdomain format for my sites. Before I remove it, subdomain.example.com would always redirect to example.com.
So i have stuck on this thing since last week . i am new to web development , and wanted to learn php , as soon as i started i had to setup apache server , for root directory it works fine but for localhost/~username/ it can't connect to server "localhost".
here are the files i had been messing up
(sudo apachectl configtest : Syntax OK )
httpd-userdir.conf file
https://www.dropbox.com/s/3zmuc2jetpo3i0i/httpd-userdir.conf?dl=0
httpd.conf file
https://www.dropbox.com/s/vlrzqr95ge2qy3c/httpd.conf?dl=0
username.conf file
https://www.dropbox.com/s/f13cgfgfb56esi7/mfaizanulhaq.conf?dl=0
(OS X el Capitan
10.11.5 (15F34)
&
Server version: Apache/2.4.18 (Unix)
Server built: Feb 20 2016 20:03:19
)
If this is still relevant and you are fed up with trying to find a solution you can change Documents root folder to your user Sites folder. This will prevent everyone but you from accessing localhost from your machine, but it's a hotfix solution. I've had a deadline and I had to finish the site, so this worked for me.
Go to httpd.conf change
DocumentRoot "/Library/WebServer/Documents"
<Directory "/Library/WebServer/Documents">
to
DocumentRoot "/Users/username/Sites"
<Directory "/Users/username/Sites">
To look up your username in the terminal use whoami.
NOTE: Bear in mind you also need to change the following lines in httpd.conf it's located just below DocumentRoot within <Directory> tag you changed earlier.
Whatever it says in your file modify to this (that should be true for ALL configurations of the Apache2)
Options FollowSymLinks Multiviews
MultiviewsMatch Any
AllowOverride All
Require all granted
This is a really bad solution since your Users/username/Sites folder will be accessed directly when you type localhost in the browser, but when something goes wrong, or you've done something wrong this is the best solution so far especially if you are 100% certain you are not going to have more than 1 user access your localhost directory.
i hope no one faces this problem. In my case i had updated php to php 7 but in httpd.conf it was trying to load php 5 so by commenting out that line my problem was solved.
I've just installed Mac OS X Yosemite fresh. I configured Apache and chmodded "users/user/Sites" to 755. When I hit localhost I receive a 403 Forbidden "You don't have permission to access / on this server". The same thing occurs with any other sites I add to my hosts file.
I tried configuring user directories following help from this post. The guys on this MacRumors thread know there is an Apache issue, but didn't offer a lot of suggestions.
My directory permissions look like this
drwxr-xr-x 29 root wheel 1054 Aug 11 07:30 /
drwxr-xr-x 6 root admin 204 Aug 11 07:29 /Users/
drwxr-xr-x+ 26 zachshallbetter staff 884 Aug 11 11:57 /Users/zachshallbetter/
0: group:everyone deny delete
drwxr-xr-x 5 zachshallbetter staff 170 Aug 11 10:16 /Users/zachshallbetter/Sites
Can anyone offer any suggestions or help? Here are links to my hosts and httpd.conf files and error logs for reference.
You do NOT want to open up the entirety of your hard drive to the web server process. In fact, lines 215-217 of httpd.conf say:
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
Apache 2.4 (OSX 10.10 Yosemite) has a different structure from Apache 2.2 (OSX 10.9) for the Directory directive in Module mod_authz_core.
EDIT: If you are setting up Apache from the START, please follow this instruction set to setup apache and php on OSX 10.10 Yosemite.
Assuming you have mod_userdir.so enabled already, your problem is within your user .conf file (/etc/apache2/users/username.conf), edit (or add) the following.
Apache 2.2:
<Directory "/Users/jnovack/Sites/">
Options Indexes MultiViews
AllowOverride All
# OSX 10.9 / Apache 2.2
Order from deny, allow
</Directory>
Apache 2.4
<Directory "/Users/jnovack/Sites/">
Options Indexes MultiViews
AllowOverride All
# OSX 10.10 / Apache 2.4
Require all granted
</Directory>
Edit the file:
/private/etc/apache2/httpd.conf
on line 250 (in Yosemite) change:
Options FollowSymLinks Multiviews
to:
Options FollowSymLinks Multiviews Indexes
then in the Terminal run:
sudo apachectl restart
This might be very late answer but i did followed most of Stack Overflow solutions, None of them helped me for various reasons. So i did reset my device as a fresh Yosemite OS to get this localhost working on Mac Yosemite (with Symlinks too),
Steps I did exactly :
sudo nano /etc/apache2/httpd.conf
Uncomment the following lines:
#LoadModule php5_module libexec/apache2/libphp5.so
to
LoadModule php5_module libexec/apache2/libphp5.so
#LoadModule userdir_module libexec/apache2/mod_userdir.so
to
LoadModule userdir_module libexec/apache2/mod_userdir.so
#Include /private/etc/apache2/extra/httpd-userdir.conf
to
Include /private/etc/apache2/extra/httpd-userdir.conf
Save and Exit (Ctrl+X press Enter and press Y and enter again)
sudo nano /etc/apache2/extra/httpd-userdir.conf
and uncomment the following line at line 16:
#Include /private/etc/apache2/users/*.conf
to
Include /private/etc/apache2/users/*.conf
Save and Exit (Ctrl+X press Enter and press Y and enter again).
Now go to apache Users folder to check your configuration file exist or not
cd /etc/apache2/users/
if you do not have configuration file in this folder, create one by
sudo nano /etc/apache2/users/<**YOUR USERNAME**>.conf
Replace <YOUR USERNAME> with the name of your machine (type whoami in terminal and enter that name).
after creating .conf file , copy below lines into that file
<Directory "/Users/<YOUR USERNAME>/Sites/">
AddLanguage en .en
LanguagePriority en fr de
ForceLanguagePriority Fallback
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from localhost
Require all granted
</Directory>
save and Exit
Now restart your apache
sudo apachectl restart
Now go to your browser and type localhost, it should work as expected,
Just as a Note: if it does not work even after try restarting your computer
create index.html as exactly index.html.en that you should find here:
open /Library/Webserver/Documents/
right click on index.html.en and duplicate it to index.html leaving original as it is
try again in browser and if you have success, you can delete the duplicated file
Just to be clear, leave the original file index.html.en where it is, untouched and unharmed throughout this step.
Not sure why I had to take this mysterious detour - probably something local to my machine, but if you're having trouble after following the guide above, see if it helps.
SymLinks :
if you have success, in Browser you should see
It works!
Now create symlink to any your project.
ln -s <Path_to_your_Project(index_file)> <Path_to_webroot>
For example if you have project folder in your Documents folder ,then point webroot to your index file by
ln -s /Users/<YOUR USERNAME>/Documents/project/ /Library/Webserver/documents/projectlink
you might need permission to create symlink (Use above command with Sudo)
Configure apache to follow symlinks ( Thanks to tomvon, i do not enough points to vote you)
sudo nano /private/etc/apache2/httpd.conf
on line 250 (in Yosemite) change:
Options FollowSymLinks Multiviews
to:
Options FollowSymLinks Multiviews Indexes
then in the Terminal run:
sudo apachectl restart
Now go to localhost/projectlink to see if your project index file shows here on browser.
Happy Coding..
The advice in this article helped me.
Specifically the "Yosemite Only" section:
First, there is a directive that helps secure your machine by denying access to the entire file system by default. I’ll show you how to remove this directive, since I find that easier on a machine meant for development. The section of code runs from line 220 through 223. You can comment out (place ‘#’ in front of each line) or just remove this section.
And the section is ...
<Directory />
AllowOverride none
Require all denied
</Directory>
Note:
As others have followed up on this with more details, the method outlined above can be insecure.
There are 2 possibility why your localhost is forbidden, first it may be because your apache setting is not correct and second, may be because you set vhost and you forget about set localhost too
sudo nano /etc/apache2/extra/httpd-vhosts.conf
Add this code
`
<VirtualHost *:80>
ServerName localhost
DocumentRoot "/Users/username/Sites"
<Directory "Users/username/Sites">
Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all
</Directory>
</VirtualHost>
Save it and restart your apache
`
sudo apachectl restart
it should be works :)
Suggestions might focus on your own user specific conf in apache but by default this configuration might not be loaded at all.
Edit the userdir module configuration:
sudo vi /etc/apache2/extra/httpd-userdir.conf
Uncomment the include of the user directory configuration files:
Include /private/etc/apache2/users/*.conf
Make sure you have a user directory configuration according our own username:
sudo vi /etc/apache2/users/.conf
Make sure you have good configuration for your home directory:
DocumentRoot "/Users/<username>/Sites/"
<Directory "/Users/<username>/Sites/">
AllowOverride All
Options Indexes MultiViews FollowSymLinks
Require all granted
</Directory>
Restart apache (webserver)
sudo apachectl restart
Check your site!
Just create the 'Sites' folder in your user folder. Go to
cd ~
mkdir 'Sites'
I just set up my XAMPP server after reinstalling Windows due to a hard drive failure. When I backed up my server files, I just copied EVERYTHING, all files and folders, from the htdocs folder. After I installed XAMPP and got the security stuff worked out, I went to copy the backed up htdocs files back to the new htdocs folder. Now, whenever I type in my domain name, the one that should point to the htdocs folder, because that is the default DocumentRoot, it instead gives me an error page saying "Access Forbidden", and the URL I see in my URL bar is "soandso.com/xampp", rather than just "soandso.com"
Why is it sending me to the htdocs/xampp folder?
I think it is because of a wrong configuration. Check out
XAMPP-FOLDER/apache/conf/extra/httpd-vhosts.conf
and make sure you sure you have
<VirtualHost yourdomain.com>
ServerAdmin admin#yourdomain.com
DocumentRoot "XAMPP-FOLDER/htdocs/domain-root-folder"
ServerName yourdomain.com
ServerAlias yourdomain.com
<Directory "XAMPP-FOLDER/htdocs/domain-root-folder">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
written there.
Note: It was tough deciding whether this belonged here or ServerFault, but it seemed like a programming problem, so if it's out of place, feel free to migrate it.
I downloaded the sandbox of Symfony 1.4.8 and copied the files to my webserver. Unfortunately, when I try to access /symfony/sf_sandbox/web/ (where I installed it), I get the following:
It seems like the images aren't showing. According to the text:
If you see no image in this page, you may need to configure your web server so that it gains access to the symfony_data/web/sf/ directory.
However, when I try to locate the folder referenced above, it does not exist:
sf_sandbox
web
css/
images/
js/
uploads/
frontend_dev.php
index.php
robots.txt
As you can see, there is no sf/ directory under web/. What am I doing wrong?
Note: I am installing this on Ubuntu 10.04 64-bit using Apache.
All the images are located in the Symfony source directory.
I would try creating a symbolic link in the web folder called sf pointed to the following:
lib\vendor\symfony\data\web\sf
It should have access to the needed images at that point.
This is done by indicating the right path in the Alias directive in your apache configuration:
# Be sure to only have this line once in your configuration
NameVirtualHost 127.0.0.1:8080
# This is the configuration for your project
Listen 127.0.0.1:8080
<VirtualHost 127.0.0.1:8080>
DocumentRoot "/home/sfprojects/jobeet/web"
DirectoryIndex index.php
<Directory "/home/sfprojects/jobeet/web">
AllowOverride All
Allow from All
</Directory>
Alias /sf /home/sfprojects/jobeet/lib/vendor/symfony/data/web/sf
<Directory "/home/sfprojects/jobeet/lib/vendor/symfony/data/web/sf">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
Just replace "/home/sfprojects/jobeet" with your project's path and it should work.
This page shows the apache config to set up a new project correctly.
There are also important security notes for your webapp.
Symfony Documentation
All you need to do is copy the whole sf folder to the web folder. In my case i copied c:\wamp\www\jobeet\lib\vendor\symfony\data\web\sf\ to c:\wamp\www\jobeet\web. Hope that makes sense