Apache
Published: 12:57, Thursday 14 July 2011
Notes
What's this? See my article about Notes.
View as plain text file.
to make local server work:
sudo apt-get install php php5-mysql php5-xsl php-apc
sudo apt-get install apache2
setup/general config file/settings: /etc/apache2/apache2.conf
/etc/apache2/sites-available/default (copied to create general)
directives
ServerAdmin email
DocumentRoot (and <Directory ...>)
originally /var/www
set to /home/nicolamr/Scrivania/prog/php
ServerName, ServerAlias, DirectoryIndex, ErrorDocument
CustomLog: default /var/log/apache2/access.log
ErrorLog: default /var/log/apache2/error.log
LogFormat, LockFile, PidFile
add "general" site:
sudo a2dissite default; sudo a2ensite general
envvars
/etc/apache2/envvars
User: APACHE_RUN_USER
Group: APACHE_RUN_GROUP
set them both to nicolamr
add website:
copy /etc/apache2/sites-available/default and edit
see [[newsite]]
add link to it in sites-enabled
sudo a2dissite old; sudo a2ensite new
can define www.asd.com.localhost
add to /etc/hosts near localhost
start/stop/restart apache:
don't use apache2 command!
-k start because of "bad user name" or other problems...
sudo service apache2 restart
sudo /etc/init.d/apache2 start
sudo /etc/init.d/apache2 stop
sudo /etc/init.d/apache2 restart
remove everything:
sudo apt-get purge apache2 apache2-mpm-worker apache2.2-common apache2.2-bin apache2-utils libapr1 libaprutil1 libaprutil1-ldap libaprutil1-dbd-sqlite3 python-couchdb
running at startup:
httpd (pid 3155) already running
cd /etc/rc2.d; sudo mv {S,K}91apache2
location of php.ini
from command-line/cli: /etc/php5/cli/php.ini
cgi: /etc/php5/cgi/php.ini (did not exist)
apache2: /etc/php5/apache2/php.ini (did not exist after install)
phpinfo: phpinfo();
mod_rewrite/.htaccess:
activate:
activate mod_rewrite
link to proxy.load, and rewrite.load in mods-available
inside <Directory>
AllowOverride All
Options FollowSymLinks
RewriteEngine on
RewriteBase path/to/.htaccess/from/web/base
RewriteRule ^([a-zA-Z0-9_\-/]*[a-zA-Z0-9_\-])$ $1/ [R,L]
RewriteRule ^([a-zA-Z0-9_\-/]+)/$ index.php?query=$1&%{QUERY_STRING} [L]
#redirect only non-existing files:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9_\-/]+\.[a-zA-Z]+)$ index.php?query=$0&%{QUERY_STRING} [L]
Write a Comment
* These fields are mandatory.