computers:web_server_configuration
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
computers:web_server_configuration [2010/11/26 10:08] – chkuo | computers: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 | ||
- | </ | ||
- | |||
- | ===== Apache ===== | ||
- | To start/ | ||
- | <code bash> | ||
- | sudo / | ||
- | sudo / | ||
- | sudo / | ||
- | </ | ||
- | |||
- | ===== Security ===== | ||
- | ==== Directory Listing ==== | ||
- | The default settings allow listing of the directory content. To prevent this, modify ''/ | ||
- | < | ||
- | < | ||
- | Options Indexes FollowSymLinks MultiViews | ||
- | AllowOverride None | ||
- | Order allow,deny | ||
- | allow from all | ||
- | </ | ||
- | </ | ||
- | to: | ||
- | < | ||
- | < | ||
- | Options -Indexes FollowSymLinks MultiViews | ||
- | AllowOverride None | ||
- | Order allow,deny | ||
- | allow from all | ||
- | </ | ||
- | </ | ||
- | |||
- | **i.e., add ' | ||
- | |||
- | ===== PHP ===== | ||
- | ==== Info ==== | ||
- | To find out the '' | ||
- | <code php> | ||
- | <?php | ||
- | |||
- | if(function_exists(' | ||
- | // use posix to get current uid and gid | ||
- | $uid = posix_geteuid(); | ||
- | $usr = posix_getpwuid($uid); | ||
- | $user = $usr[' | ||
- | $gid = posix_getegid(); | ||
- | $grp = posix_getgrgid($gid); | ||
- | $group = $grp[' | ||
- | }else{ | ||
- | // try to create a file and read it's ids | ||
- | $tmp = tempnam ('/ | ||
- | $uid = fileowner($tmp); | ||
- | $gid = filegroup($tmp); | ||
- | |||
- | // try to run ls on it | ||
- | $out = `ls -l $tmp`; | ||
- | $lst = explode(' | ||
- | $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"; | ||
- | </ | ||
- | |||
- | Under a standard installation, | ||
- | |||
- | ==== Problems and Solutions==== | ||
- | If the browser asks to download the php files (instead of parsing them), comment all lines from < | ||
- | |||
- | ===== Dokuwiki Installation ===== | ||
- | ==== Permissions ==== | ||
- | Make the permissions more restrictive for security reasons. Assuming the wiki is installed in ''/ | ||
- | |||
- | <code bash> | ||
- | # change the ownership | ||
- | sudo chown -R root: | ||
- | # make data, conf, and lib writable by group | ||
- | sudo chmod -R g+w / | ||
- | # restrict access by other | ||
- | sudo chmod -R o-rwx / | ||
- | </ | ||
- | |||
- | |||
computers/web_server_configuration.1290737336.txt.gz · Last modified: 2010/11/26 10:08 by chkuo