OS X Lion Server - Apache Question - index.html.en - macos

I've added some additional sites to my apache config today, however the default document root should serve the "It Works" index.html.en apache default page. However I must of altered something by accident as it now displays the directory listing by default instead? If I navigate to index.html.en it successfully loads, but not by default when I enter 127.0.0.1 for example.
I'm sure the .en language files are resolved by httpd-languages.conf, I have doubled checked that files dependancies are included in httpd.conf 'mod_mime' & 'mod_negotiation'.
The problem shouldn't bother me to much but I would like to discover the cause if possible?

Specify your DirectoryIndex by putting:
DirectoryIndex index.html.en
in httpd.conf or .htaccess files.

Related

Change localhost/htdocs folder in Xampp 8.2

I know this is not a new question but I think something has changed with Xampp in the latest version. I was using Xampp 8.0 and was using another directory to serve as localhost just fine. My Xampp installation is in C:/xampp while my projects are located in D:\Whip\Projects. This is the folder I want to load when using the address localhost.
I changed 2 lines in httpd.conf like I had done several times before
DocumentRoot "D:\Whip\Projects"
<Directory "D:\Whip\Projects">
The folder loads but PHP doesn't work properly. I get errors related to missing session folders and extensions. The problem is in php.ini file the paths are not absolute anymore. For example, in xampp 8.0 I had
session.save_path="C:\xampp\tmp"
In 8.2 I have
session.save_path="\xampp\tmp"
And same thing with extensions directory and all other paths defined in php.ini (and who knows where else). If I manually add C: to the path above, the sessions start working. I'm apprehensive of changing every path like that. Is there a better way to change the htdocs folder now?

Cannot get site loaded with Apache on Mac

I'm running El Capitan and trying to get my website hosted locally for development with Apache (that came with the OS). I followed the instructions here exactly. I made an anthony.conf file and put the Directory text in there, I replaced the actual directory with /Users/anthony/dev/web/unfinished-asteroids/ and then placed my web files in there. I started apache and navigated for localhost/~anthony but I get the
Not Found: The requested URL /~anthony was not found on this server.
standard 404 error. When I navigate to localhost it works fine and I get the "It works" from the index.html that is located in /Library/WebServer/Documents, I even changed that index.html file and it works fine.
Any ideas why I'm not able to see my website using apache? All I did was download this github repository and place it in my unfinished-asteroids folder, the index.html is at the root.
So it looks like there are a couple of extra steps that you need to do. There isn't really anything too special about apache that comes with OSX, so your standard apache configurations will work. but to get Userdir (~username) working on El Capitan,this is what I had to do
Edit /etc/apache2/httpd.conf
on (or near) line 166, uncomment
loadModule userdir_module libexec/apache2/mod_userdir.so
then on line 493 uncomment
Include /private/etc/apache2/extra/httpd-userdir.conf
then edit file /etc/apache2/extra/httpd-userdir.conf
uncomment line 16
Include /private/etc/apache2/users/*.conf
then in /etc/apache2/users/anthony.conf
<Directory "/Users/anthony/Sites/">
Options Indexes MultiViews
Require all granted
</Directory>
then sudo apachectl restart
That should make http://localhost/~anthony point to your sites directory.
Logs are stored in /var/log/apache2
Now if all you want is web access to say your dev directory you can do something like this.. (don't make any of the changes listed above)
in /etc/apache2/other/ create a file called mydev.conf (name doesn't really matter, save it needs to end in .conf')
and put this in that file
Alias /dev /Users/anthony/dev/
<Directory "/Users/anthony/dev">
Options Indexes MultiViews
Require all granted
</Directory>
and reload apache (sudo apachectl restart)
then you will be able to access your dev folder at http://localhost/dev and should be able to access your page at http://localhost/dev/web/unfinished-asteroids/
you can adjust the paths at will above, just need to make sure that the user or group _www has access to it, and that paths in the alias and the directory match.

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.

Why does fatfree need a RewriteBase on Mac but not Ubuntu?

I've used FatFree quite a lot recently on Ubuntu, and have had no problems putting it into subdirectories. However, I recently tried to do this in a user website on Mac (10.6.8) and ran into the problem of needing a RewriteBase for the routing to work.
I was wondering if anyone has any idea why the default Apache setup on Ubuntu seems to allow the routing to work without a RewriteBase in the .htaccess, but the setup on Mac makes it necessary.
The Ubuntu setup uses a bunch of VirtualHosts, whereas the Mac config just has a server config, mod_userdir enabled and a directive for each user's Sites directory.
The mod_rewrite documentation says that the RewriteBase directive is required unless either of the following conditions are true:
The original request, and the substitution, are underneath the DocumentRoot (as opposed to reachable by other means, such as Alias).
The filesystem path to the directory containing the RewriteRule, suffixed by the relative substitution is also valid as a URL path on the server (this is rare).
The first condition is probably met with your Ubuntu setup but not with your Mac setup, since you are using mod_userdir. If you move your files from ~/Sites to the DocumentRoot (default on Mac is /Library/Webserver/Documents), chances are that you won't need the RewriteBase anymore.
I'm not sure, but i can tell you that most apache setups have RewriteBase / as default value, which makes it superfluous to write it in your .htaccess file once more, if your F3 is on webroot. Maybe this portion is missing in a MAMP setup on mac.
Running F3 in a subdir of the virtualhost or webroot usually always requires a valid definition of RewriteBase.
Additional information about this can be found here:
https://github.com/bcosca/fatfree/wiki/FAQ#can-i-run-f3-in-a-sub-directory
Let me just explain how you should analyze the difference between the Mac and Ubuntu configurations so you can understand why RewriteBase is required by one but not the other. Add this to your Apache config:
RewriteLog /var/log/apache2/error.log
RewriteLogLevel 9

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