cannot enable htaccess support on Lion Apache - macos

I was running with MAMP for a while but then got to thinking that it wouldn't hurt to get into the bones of Apache itself.
So the default options worked great for me, even enabled a couple of virtual hosts too and they work great. However, I can't get Apache to support my htaccess files.
This is my Apache config https://gist.github.com/1332527 with my virtual host config as well https://gist.github.com/1332542
My sites work at min.local/index.php/some-url for example but fail at min.local/some-url where I get a 404. I've read a number of blog posts about setting AllowOverride to All in httpd.conf but it hasn't made a difference.
My .htaccess file is fine, it works in production.
Any suggestions?
Thanks,
Steven

Also, make sure to look at your user-specific conf file, located at /etc/apache2/users/username.conf and set your AllowOverride there.
The settings there will override the defaults in httpd.conf
just set it to All or whatever you have in httpd

I suspect the AllowOverride None in the virtual host file is overriding the AllowOverride All in the main config file. Try changing it to All and see what happens.

I had exactly the same issue. In my vhost block I had to add
<Directory "{webroot path}">
AllowOverride all
Allow from all
</Directory>
On restarting apache (sudo apachectl restart) all was good.

Related

Laragon auto Vartual host file gets reset on refresh

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.

Apache 403 when hitting name.local Yosemite

This is the first time I'm setting up an apache web server, I'm doing this on my Mac with OS X Yosemite. For some reason I'm receiving 403 errors when I try to hit my user directory via the browser with the formate computerName.local. When I hit the default directory with that same format I get the "It works!" page, but when I try to hit my user directory it gives me the "Forbidden" error... If I hit it with localhost everything works fine, but I'm trying to hit it from my iPhone hence the localhost won't work from there...
I've tried every guide I could find, tried setting the vhosts configuration file (but when I do so the browser can't reach the folder even when trying localhost), I tried changing the httpd.conf file to have "Require all granted" on a new with the path to my user sites directory... Can anyone tell me if I'm doing something wrong? If you need I could upload my httpd.conf and httpd-vhosts.conf files (or any other related file that may need configuration).
Thanks!
Found the issue. It took me a while but it was really simple at the end. On my User conf file /private/etc/apache2/users/USERNAME.conf there was a line that was absolutely responsible for the behavior that from localhost everything worked fine but from computerName.local it wouldn't. This is what the file looked like:
<Directory "/Users/Santiago/Sites/">
AddLanguage en .en
LanguagePriority en fr de
ForceLanguagePriority Fallback
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order allow,deny
Allow from localhost
Require all granted
</Directory>
All I had to do was change that "Allow from localhost" to "Allow from all" and restart apache. Everything works now.

Unable to connect to local host after modifying Apache config file (Windows)

I have downloaded the Apache HTTP server for windows and installed it. I have created a test html file under C:/mobileTraining/core/workspace/TestProject
I then added a permissions directory tag in the httpd.conf file, so that it now looks like the following:
<Directory />
AllowOverride none
Require all denied
</Directory>
<Directory C:/mobileTraining/core/workspace>
Order allow,deny
Allow from all
</Directory>
Alias /TestProject C:/mobileTraining/core/workspace/TestProject
I've tried this with and without the first Directory tag, which was there already.
When I then save these changes and go to http://localhost/TestProject/TestPage.html in my browser (I've tried Firefox and Chrome), I get a connection error. This is from Chrome:
This webpage is not available
Google Chrome's connection attempt to localhost was rejected. The website may be down, or your network may not be properly configured.
Error code: ERR_CONNECTION_REFUSED
Is there something blindingly obvious in my set-up that I've missed?
Thanks
Try to access your site by including the port the default setup for this is 8080
http://localhost:8080/TestProject/TestPage.html
First, make sure you are able to access http://localhost/
Also, i suppose you have TestPage.html in C:/mobileTraining/core/workspace/TestProject
You are setting permissions for C:/mobileTraining/core/workspace ?
As mentioned in Example here . Try below.
Alias /TestProject "C:/mobileTraining/core/workspace/TestProject"
<Directory "C:/mobileTraining/core/workspace/TestProject">
Order allow,deny
Allow from all
</Directory>
Good Luck!

codeigniter localhost setup 404 page not found error

I have a localhost setup(i use apache's virtualhost setup) for a site I am working on with codeigniter. I use SVN for the site.
I decided to change the localhost-domain name and the root-folder name(this is the folder from within which I check out SVN) to which the localhost-domain points.
To show a better picture, I changed;
sledge-vicky.localhost to hammer-vicky.localhost
Changed the document-root's name from "sledge" to "hammer". Have changed the document root,directory paths in the virtualhost setup too;
<VirtualHost hammer-vicky.localhost>
DocumentRoot D:\xampp\htdocs\vicky\projects\hammer
ServerName hammer-vicky.localhost
<Directory "D:\xampp\htdocs\vicky\projects\hammer">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Have set the domain-name in windows' hosts file. Have set/changed the base-url and database settings in config.php and database.php too(I use environment dir; _environment/vicky/config.php, _environment/vicky/database.php ).
In the code where we switch to the required app-environment, I have set the code to switch to my app-environment too.
http://sledge-vicky.localhost/ was working fine.
After the local-domain name and root-folder name change, accessing http://hammer-vicky.localhost/ throws a '404 page not found error'.
Any idea what could be wrong?.
My bad debugging. I got it working. I had to change other settings in some files specific to my environment (in my case, /application/config/_environment/...) that were related to some global settings(which in my case, others sharing the same svn-repository had changed).

Error getting images to show up in Symfony 1.4.8

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

Resources