Why does Apache serve different directories when accessed from different machines? - apache

I'm trying to configure Apache on OS X 10.8.2 so that the default "system" site is accessible from other machines, while the "user" site is not. In httpd.confI have
DocumentRoot "/Library/WebServer/Documents"
<Directory />
Options -FollowSymLinks -MultiViews
AllowOverride None
Order deny,allow
Deny from all
</Directory>
<Directory "/Library/WebServer/Documents">
Options Indexes -FollowSymLinks -MultiViews
AllowOverride None
Order deny,allow
Allow from all
</Directory>
and in ME.conf I have
<Directory "/Users/ME/Sites">
Options Indexes -FollowSymLinks -MultiViews
AllowOverride None
Order deny,allow
Deny from all
Allow from localhost
</Directory>
This behaves as intended when accessed from the hosting machine: http://localhost/~ME/ maps to /Users/ME/Sites and http://localhost maps to /Library/WebServer/Documents. But when I acces the hostng machine from a different machine, http://hostingmachine doesn't work, and http://hostingmachine/~ME/ maps to /Library/WebServer/Documents. What have I done to deserve that? Is there a way to do what I'm trying to do, or at least something close?

Related

Apache: Install Baikal besides Seafile

I need a hint in which direction I should look for an answer on this.
I have set up a Seafile server which is accessible under https://subdomain.no-ip.org, i now want baikal to be accessible under https://subdomain.no-ip.org/baikal
However, I can't get it running because i always get a message from Seafile that this directory does not exist. (I guess seafile thinks it should be a subdirectory)
my recent try to configure apache -
sites-enabled/default-ssl
<VirtualHost *:443>
ServerAdmin webmaster#localhost
Servername gasslnet.no-ip.org
DocumentRoot /var/www
Alias /media /home/andie/seafile-directory/seafile-server-latest/seahub$
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
<Directory "/var/www/baikal/html">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
My Seafile-Settings:
ccnet/ccnet.conf
SERVICE_URL = https://subdomain.no-ip.org
seahub_settings.py
FILE_SERVER_ROOT = 'http://subdomain.no-ip.org/seafhttp'
I think the issue is in the seafile configuration, if seafile would be accessible under url/seafile and not only the url the problem should be solved. I tried changing the SERVICE_URL, but no effect.
Do you have any ideas about this?
You have to set
SITE_ROOT = '/seafile'
in the seahub_settings.py to access Seafile under
http://subdomain.no-ip.org/seafile

Apache virtual host permissions not working

I need some help here my virtual hosts permissions appear not to be working.
For example site1.com and site2.com can access each others files and even create files!. I have tried to prevent this by having this in the apache2.conf file.
<Directory />
Options FollowSymLinks
Order deny,allow
Deny from all
</Directory>
And then in the virtual host file for site1 I have this
<Directory /var/www/site1.com/public_html>
Options indexes, FollowSymLinks
Order Allow,Deny
Allow from all
</Directory>
And for the virtual host ifle in site2 I have this
<Directory /var/www/site2.com/public_html>
Options indexes, FollowSymLinks
Order Allow,Deny
Allow from all
</Directory>
Can anyone help me with this please as its a big security issue?
What have I done wrong?
Thanks,
Dan
An Apache configuration doesn't have anything to do with who/what can create files in the filesystem, it only determines what this particular program (httpd) is willing to serve.

How can I display all files in a web directory?

I am running Ubuntu 13.10 with Apache 2.4 and i want to make a folder which will contain all my PHP files that I am making for testing purposes. I created a Vhost for the folder and it works when i target the sepcific file in mind, in example :
http:/phptestsite/some_random_php_script.php
When i go there the code (if it works ;) ) will execute, but I want to create a list of all php files (similar to that of a ftp site/listing) when i go to
http:/phptestsite/
So that i do not have to manually type in everytime each individual php script I want to test, but just go to that vhost and click on the file.php I want to test.
Vhost conf:
<VirtualHost *:80>
DocumentRoot /home/usrnname/PHPTest/
ServerName phptest
ServerAlias phptest
<Directory />
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Directory /home/username/PHPTest/>
Options FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
you should add Options +Indexes to list the directories
<Directory /home/username/PHPTest/>
Options FollowSymLinks MultiViews +Indexes
AllowOverride All
Require all granted
</Directory>

404 Error on Certain Pages Using SSL

I'm trying to enable ssl on my wordpress site and am running into a bit of difficulty. I've enabled ssl admin through the wordpress ssl plugin (well reviewed) and also required ssl for a couple other pages. The administration panel works well with https as does the homepage and a couple other pages. However on many of them, namely pages that I've dynamically generated with a php plugin that I wrote, I get a 404 error:
Not Found
The requested URL /create/5 was not found on this server.
Apache/2.2.22 (Ubuntu) Server at upsmart.com Port 443
Approaches that havent worked so far include:
I've enabled mod-rewrite on the server, I've tried changing the site url in the dashboard to explicitly be https:// and I've scanned the php for hard-coded instances of http://
Really scratching my head on this one so any ideas would be appreciated.
For reference I'm using Apache on Ubuntu 12.04.
Update!
I checked my Apache error log and came out with the following message:
File does not exist: /home/user/www/create
My reaction upon seeing that is "Well of course it doesn't. If I'm trying to get it to get it to http://example.com/create/ why would it be reading that as ~/www/create?
Please allow me to blush a little; the update I gave to the question above allowed me to take a guess at the issue but I'll put it down in case anyone else runs into the problem.
I found that I had only half-configured the file /etc/apache2/sites-enabled/default-ssl.
The file began as follows:
ServerAdmin webmaster#localhost
DocumentRoot /home/sam/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/sam/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride none
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
The issue was that the second AllowOverride needed to be changed from none to all. So that it would look like this.
ServerAdmin webmaster#localhost
DocumentRoot /home/sam/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/sam/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride none
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
Mind you: This must be configured for ssl even if you have configured this for other sites-enabled like 000-default.
There's no difference between the configurations.

Apache Config for PHP and Web2Py

I'm setting up a server for home to run all sorts of things. I'll save you the whole story, but I'm trying to get it to run Web2Py through WSGI, but also need to serve PHP files for other web apps I have. I tried the install script for Web2Py, but that "hijacked" the entire Apache system to run the Web2Py system.
The setup currently works for PHP and SSL pages, but I cannot get it to also process requests for the Web2Py site. For the Web2Py url (http://jupiter/web2py), I get an Apache directory listing. Please help.
The directory structure is this:
/var/www --> Apache DocumentRoot
/var/www/scripts --> various PHP scripts
/var/www/web2py --> Web2Py
The /etc/apache2/sites-available/default file is setup as this:
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin me#yahoo.com
ServerName jupiter.myhome.com
WSGIDaemonProcess web2py user=www-data group=www-data display-name=%{GROUP}
WSGIProcessGroup web2py
WSGIScriptAlias /web2py /var/www/web2py/wsgihandler.py
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow, deny
allow from all
</Directory>
<Directory /var/www/web2py>
AllowOverride None
Order Allow,Deny
Deny from all
<Files wsgihandler.py>
Allow from all
</Files>
</Directory>
AliasMatch ^/([^/]+)/static/(.*) /var/www/web2py/applications/$1/static/$2
<Directory /var/www/web2py/applications/*/static/>
Order Allow,Deny
Allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
#comment
#comment
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
I successfully configured a Joomla (PHP) application + Web2py. Your apache config seems ok. Just make sure you configure your /web2py/routes.py with the correct path_prefix (as per your example it should be 'web2py'):
routers = dict(
BASE = dict(
default_application='<your_default_app>',
path_prefix='web2py',
)
)