I. URL Uniform Resource Locator
http://www.sina.com.cn:80/admin/index.html
Two. Installation of the environment
LAMP 源码包编译安装 版本可以自定义 生产环境 安全 稳定 开发环境
Three. Related Documents
配置文件位置 /usr/local/apache2/etc/httpd.conf /usr/local/apache2/etc/extra/httpd-*.conf 网页文件默认保存位置 /usr/local/apache2/htdocs/ 日志保存位置 /usr/local/apache2/logs/ 日志处理(切割轮替) vim /etc/logrotate.conf /usr/local/apache2/logs/access_log { daily rotate 30 } /usr/local/apache2/logs/error_log { daily rotate 30 } logrotate -f /etc/logrotate.conf 手动执行文件 cd /usr/local/apache2/logs/
Four. Configuration files
Command alias Aliasvim/root/.bashrcalias sto= '/usr/local/apache2/bin/apachectl stop ' Alias Sta= '/usr/local/apache2/bin/ Apachectl start ' Source/root/.bashrcstosta Experiment 1 directory Alias extension Site Directory add server 1. Modify the master configuration file vim/usr/local/apache2/etc/httpd.conf 453 Include etc//extra/httpd-autoindex.conf 2. Configuring a Child profile vim/usr/local/apache2/etc/extra/httpd-autoindex.conf alias/www/"/usr/local/apache2/www/" <directory "/usr/local/apache2/www/" > Options Ind EXEs allowoverride None Require all granted </Directory> 3. Set up www directory mkdir/usr /local/apache2/www/vim/usr/local/apache2/www/index.html HELLO/USR/LOCAL/APACHE2/WWW/4. Restart Service test Trial STO STA Test 192.168.183.251/www/Experiment 2 Virtual Host 1. Domain name resolution (file parsing) (Windows) C:\Windows\System32\dr Ivers\etc\hosts 192.168.183.251 www.sina.com 192.168.183.251 www.sohu.com 2. Website domain name Planning mkdir-p/share/s ina/mkdir/share/sohu/vIm/share/sina/index.html vim/share/sohu/index.html 3. Modify the configuration file vim/usr/local/apache2/etc/httpd.conf 465 in Clude etc//extra/httpd-vhosts.conf 4. Modifying a child configuration file vim/usr/local/apache2/etc/extra/httpd-vhosts.conf <Directo Ry "/share/sina/" > Options Indexes-allowoverride None Require all granted </Directory> <directory "/share/sohu/" > Options Indexes 31 AllowOverride None Require All granted </Directory> <virtualhost 192.168.183.251&G T ServerAdmin [email protected] Notoginseng documentroot "/share/sina/" ServerName www.sina.com Errorlog "Logs/sina-error_log" Customlog "Logs/sina-access_log" Common </VirtualHost> <virtualhost 192.168.183.251> ServerAdmin [email protected] DocumentRoot "/share/sohu/" ServerName www.sohu.com errorlog "Logs/sohu-error_log" Customlog Logs/sohu-access_log "Common </VirtualHost> 5. Restart Service Test STO STA Test www.sina.com www.sohu.com Experiment 3 rewrite rewrite/redirect Www.sina.com-www.sohu.com (301 permanent redirection) 1. Modify the configuration file vim/usr/local/apache2/etc/httpd.conf 147 LOADMO Dule Rewrite_module modules/mod_rewrite.so 2. Modify the child configuration file (virtual host file) vim/usr/local/apache2/etc/extra/httpd-vhosts.conf <directory "/share/sina/" > Options Indexes followsymlinks allowoverride all 26 Require all granted </Directory> 3. Create a permission file. htaccess vim/share/sina/.htaccess 1 rewriteengine o N 2 rewritecond%{http_host} www.sina.com 3 rewriterule. * http://www.sohu.com 4. Restart Service Test STO s TA test www.sina.com-www.sohu.com Web file jump 1. Modify. htaccess index (). HTML index.php vim/s Hare/sina/.htaccess 1 rewriteengine on 2 rewriterule index (\d+). HTML index.php?id=$1 2. Build index.php Vim/share/sina/index . PHP 1 <?php echo "Rewrite"?> 3. Restart Service Test STO STA test www.sina.com/index5.html
"Linux" Apache service configuration