centos7安裝配置apache(httpd)
阿新 • • 發佈:2018-05-21
centos7安裝配置apache(ht安裝:
支持目錄索引:
a. 首頁索引:
vim /etc/httpd/conf.d/welcome.conf
![技術分享圖片](http://i2.51cto.com/images/blog/201805/21/d51003b2d636d62bd6d352309fa015b9.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
b. 自定義索引樣式:
vim /etc/httpd/conf/httpd.conf
![技術分享圖片](http://i2.51cto.com/images/blog/201805/21/5097f0695c2add6f5ebb054ff46ffdf4.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
支持php:
![技術分享圖片](http://i2.51cto.com/images/blog/201805/21/a48780e3b91b9e0c40a495b75606dc22.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
開啟pathinfo:
![技術分享圖片](http://i2.51cto.com/images/blog/201805/21/34296b2a1c94823a1231109cd85414ac.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
解決跨域:
![技術分享圖片](http://i2.51cto.com/images/blog/201805/21/351c2150606996b79ed87ae8c5804381.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
開啟rewrite功能:
![技術分享圖片](http://i2.51cto.com/images/blog/201805/21/f742119f1f64e86f4ad383f4d0aacb02.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
配置虛擬主機:
![技術分享圖片](http://i2.51cto.com/images/blog/201805/21/26c527e085136089dd10a35222878502.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
配置文件參考:
yum -y install httpd
a. 首頁索引:
vim /etc/httpd/conf.d/welcome.conf
![技術分享圖片](http://i2.51cto.com/images/blog/201805/21/d51003b2d636d62bd6d352309fa015b9.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
b. 自定義索引樣式:
vim /etc/httpd/conf/httpd.conf
![技術分享圖片](http://i2.51cto.com/images/blog/201805/21/5097f0695c2add6f5ebb054ff46ffdf4.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
![技術分享圖片](http://i2.51cto.com/images/blog/201805/21/a48780e3b91b9e0c40a495b75606dc22.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
![技術分享圖片](http://i2.51cto.com/images/blog/201805/21/34296b2a1c94823a1231109cd85414ac.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
![技術分享圖片](http://i2.51cto.com/images/blog/201805/21/351c2150606996b79ed87ae8c5804381.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
![技術分享圖片](http://i2.51cto.com/images/blog/201805/21/f742119f1f64e86f4ad383f4d0aacb02.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
![技術分享圖片](http://i2.51cto.com/images/blog/201805/21/26c527e085136089dd10a35222878502.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
ServerRoot "/etc/httpd" Listen 80 Include conf.modules.d/*.conf User apache Group apache ServerAdmin root@localhost <Directory /> AllowOverride none Require all denied </Directory> DocumentRoot "/var/www/html" <Directory "/var/www"> AllowOverride None Require all granted </Directory> <Directory "/var/www/html"> Header set Access-Control-Allow-Origin * Options Indexes FollowSymLinks IndexStyleSheet "/css/style.css" IndexOptions FancyIndexing HTMLTable ScanHTMLTitles FoldersFirst NameWidth=85 DescriptionWidth=128 IconWidth=16 IconHeight=16 VersionSort Charset=UTF-8 AllowOverride all Require all granted AcceptPathInfo on </Directory> <IfModule dir_module> DirectoryIndex index.html </IfModule> <Files ".ht*"> Require all denied </Files> ErrorLog "logs/error_log" LogLevel warn <IfModule log_config_module> LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%h %l %u %t \"%r\" %>s %b" common <IfModule logio_module> LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio </IfModule> CustomLog "logs/access_log" combined </IfModule> <IfModule alias_module> ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" </IfModule> <Directory "/var/www/cgi-bin"> AllowOverride None Options None Require all granted </Directory> <IfModule mime_module> TypesConfig /etc/mime.types AddType application/x-compress .Z AddType application/x-gzip .gz .tgz AddType text/html .shtml AddType application/x-httpd-php .php .phtml .php3 .inc AddOutputFilter INCLUDES .shtml </IfModule> AddDefaultCharset UTF-8 <IfModule mime_magic_module> MIMEMagicFile conf/magic </IfModule> EnableSendfile on IncludeOptional conf.d/*.conf <VirtualHost *:80> ServerName virtual.dollar.com DocumentRoot "/var/www/html/virtual/" DirectoryIndex index.php index.html <Directory "/var/www/html/virtual/"> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost>
centos7安裝配置apache(httpd)