User Tools

Site Tools


computers:web_server_configuration

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
computers:web_server_configuration [2010/11/26 10:08] chkuocomputers:web_server_configuration [2011/08/10 01:08] (current) – removed chkuo
Line 1: Line 1:
-====== Web Server Configuration ====== 
- 
-===== Packages ===== 
-To install Apache and PHP on Ubuntu: 
- 
-<code bash> 
-sudo apt-get install apache2 
-sudo apt-get install php5 libapache2-mod-php5 
-</code> 
- 
-===== Apache ===== 
-To start/stop/restart the service: 
-<code bash> 
-sudo /etc/init.d/apache2 start 
-sudo /etc/init.d/apache2 stop 
-sudo /etc/init.d/apache2 restart 
-</code> 
- 
-===== Security ===== 
-==== Directory Listing ==== 
-The default settings allow listing of the directory content. To prevent this, modify ''/etc/apache2/sites-available/default'' from: 
-<file> 
- <Directory /var/www/> 
- Options Indexes FollowSymLinks MultiViews 
- AllowOverride None 
- Order allow,deny 
- allow from all 
- </Directory> 
-</file> 
-to: 
-<file> 
- <Directory /var/www/> 
- Options -Indexes FollowSymLinks MultiViews 
- AllowOverride None 
- Order allow,deny 
- allow from all 
- </Directory> 
-</file> 
- 
-**i.e., add '-' to 'Indexes'** 
- 
-===== PHP ===== 
-==== Info ==== 
-To find out the ''uid'' and ''gid'', execute the following script: 
-<code php> 
-<?php 
-  
-if(function_exists('posix_geteuid')){ 
-    // use posix to get current uid and gid 
-    $uid   = posix_geteuid(); 
-    $usr   = posix_getpwuid($uid); 
-    $user  = $usr['name']; 
-    $gid   = posix_getegid(); 
-    $grp   = posix_getgrgid($gid); 
-    $group = $grp['name']; 
-}else{ 
-    // try to create a file and read it's ids 
-    $tmp = tempnam ('/tmp', 'check'); 
-    $uid = fileowner($tmp); 
-    $gid = filegroup($tmp); 
-  
-    // try to run ls on it 
-    $out = `ls -l $tmp`; 
-    $lst = explode(' ',$out); 
-    $user  = $lst[2]; 
-    $group = $lst[3]; 
-    unlink($tmp); 
-} 
-  
-echo "Your PHP process seems to run with the UID $uid ($user) and the GID $gid ($group)\n"; ?> 
-</code> 
- 
-Under a standard installation, both the ''uid'' and the ''gid'' are ''www-data'' 
- 
-==== Problems and Solutions==== 
-If the browser asks to download the php files (instead of parsing them), comment all lines from <IfModule mod_userdir.c> to the next </IfModule> in ''/etc/apache2/mods-available/php5.conf'' and restart apache2. 
- 
-===== Dokuwiki Installation ===== 
-==== Permissions ==== 
-Make the permissions more restrictive for security reasons. Assuming the wiki is installed in ''/var/www/wiki'' 
- 
-<code bash> 
-# change the ownership 
-sudo chown -R root:www-data /var/www/wiki 
-# make data, conf, and lib writable by group 
-sudo chmod -R g+w /var/www/wiki/data /var/www/wiki/conf /var/www/wiki/lib 
-# restrict access by other 
-sudo chmod -R o-rwx /var/www/wiki 
-</code> 
- 
- 
  
computers/web_server_configuration.1290737336.txt.gz · Last modified: 2010/11/26 10:08 by chkuo