Introduction to Linux Web Site configuration features
Many people can use different ports and different web directories.
Visit the website such as: HTTP://HOST:PORT/A/B/C/D/C will redirect to index.php.
Use: $_server["Redirect_url"], you can get "/a/b/c/d/c".
Help to build a convenient web site framework.
Steps
First Step
/etc/apache2/mods-avaiable/has a module: rewrite.load, copy it to the directory/etc/apache2/mods-enabled/, or make a soft connection.
Second Step
If you need to add a new port and site directory (such as port: 10000, Directory:/home/www/heqiunong), open/etc/apache2/sites-available/default
Add the following code:
| <virtualhost *:10000> ServerAdmin Webmaster@localhost Documentroot/home/www/heqiunong <directory/> Options FollowSymLinks AllowOverride None </Directory> <Directory/home/www/heqiunong> Options Indexes followsymlinks MultiViews AllowOverride All <ifmodule mod_rewrite.c> Rewriteengine on Rewritebase/ Rewritecond%{request_filename}!-d Rewritecond%{request_filename}!-f Rewriterule ^ (. *) $/index.php?$1 [qsa,pt,l] </IfModule> 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 # Possible values Include:debug, info, notice, warn, error, crit, # Alert, Emerg. LogLevel warn Customlog ${apache_log_dir}/access.log combined </VirtualHost> |
Third Step
(Listening port)
Open/etc/apache2/ports.conf
Add the following code
Namevirtualhost *:10000 Listen 10000 |