appach2.4 + php7 配置

來源:互聯網
上載者:User

標籤:

步驟1.首先開啟Apache2.2\conf裡面的httpd.conf檔案。在裡面找到:

ServerRoot ,改成Appache所在目錄 

步驟二 在LoadModule 後面添加支援php7的擴充

3.為了讓apache把index.php也設為預設頁把

<IfModule dir_module>    DirectoryIndex index.html</IfModule>

修改為

<IfModule dir_module>    DirectoryIndex index.html index.php</IfModule>
在一堆LoadModule下面添加

# php7 support
LoadModule php7_module E:/php-7.0.10-Win32-VC14-x86/php7apache2_4.dll
AddType application/x-httpd-php .php .html .htm
# configure the path to php.ini
PHPIniDir "E:/php-7.0.10-Win32-VC14-x86"

步驟三 尋找<Directory>

修改所有<Directory> 的路徑為appache所在目錄

步驟四

LoadModule rewrite_module modules/mod_rewrite.so這行,將他前面的“#”去掉。

Include conf/extra/httpd-vhosts.conf將他前面的“#”去掉。(很關鍵)

:儲存該檔案。然後到Apache2.4\conf\extra裡面的httpd-vhost.conf檔案開啟:

將裡面的:


<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "C:/Apache2.2/docs/dummy-host2.x"
ServerName dummy-host2.x
ErrorLog "logs/dummy-host2.x-error.log"
CustomLog "logs/dummy-host2.x-access.log" common
</VirtualHost>

刪除,然後添加一個虛擬子目錄

<VirtualHost *:80>
DocumentRoot "e:/think"
ServerName www.hgj.com
<Directory "e:\think">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

有多少個就配置多少個這樣的虛擬目錄。

然後儲存。

管理員權限開啟cmd,註冊apache服務,註冊完了才會出現在
Apache Service Monitor 裡面。

e:\Apache24\bin\httpd.exe -k install

步驟5:找到C:\WINDOWS\system32\drivers\etc裡面的hosts檔案,開啟:

可以指定多個虛擬名稱如:

127.0.0.1   www.hgj.com。

儲存。

大功告成。

重啟apache。我的是appserv。重啟。然後在瀏覽器寫:

http://localhostes。斷行符號試試。

很有意思吧。如果你覺得不好

appach2.4 + php7 配置

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.