關於阿里雲配置LAMP和配置多個虛擬主機
阿新 • • 發佈:2018-12-31
安裝apache2.4
因為centos6.8的yum中預設是apache2.2的所以需要升級yum源
可參考:centos安裝apache2.4
第一次service httpd start啟動會報錯:修改成以下
276 #ServerName www.example.com:80
277 ServerName localhost:80
開啟:NameVirtualHost *:80
(將前面#去掉)
關於apache開啟重寫機制:
開啟/etc/httpd/conf/httpd.conf配置檔案:將一下兩處AllowOverride All改為AllowOverride None
①:
302 <Directory />
303 Options FollowSymLinks
304 AllowOverride All
305 </Directory>
②:
317 <Directory "/var/www/html">
318
319 #
320 # Possible values for the Options directive are "None", "All",
321 # or any combination of:
322 # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
323 #
324 # Note that "MultiViews" must be named *explicitly* --- "Options All"
325 # doesn't give it to you.
326 #
327 # The Options directive is both complicated and important. Please see
328 # http://httpd.apache.org/docs/2.2/mod/core.html#options
329 # for more information.
330 #
331 Options Indexes FollowSymLinks
332
333 #
334 # AllowOverride controls what directives may be placed in .htaccess files.
335 # It can be "All", "None", or any combination of the keywords:
336 # Options FileInfo AuthConfig Limit
337 #
338 AllowOverride All
339
340 #
341 # Controls who can get stuff from this server.
342 #
343 Order allow,deny
344 Allow from all
345
346 </Directory>
安裝mysql5.5
安裝php5.6
一、在/etc/httpd/conf.d/目錄下新增一個檔案(字尾以.conf皆為即可),因為在/etc/httpd/conf/httpd.conf配置中,Include conf.d/*.conf
表示回去cond.d中載入自定義的配置檔案,所以一般不要修改主配置檔案
內容為:
<VirtualHost *:80>
DocumentRoot /var/www/html/***(網站根目錄)
ServerName www.****.com(域名)
ErrorLog /var/www/html/***/error.log(錯誤日誌)
CustomLog /var/www/html/***/log.log common(這裡後面的common引數不要忘記了,否則重啟會報錯)
</VirtualHost>
二、配置/etc/hosts檔案
ip 域名
參考文章:配置多虛擬主機
tip:大神請繞道