想學習PHP,在網上找了些資料看了一下。介紹一個簡單快速的服務器搭建方法,基於WAMP(WINDOWS+APATCH_MYSQL/MARIADB+PERL/PHP/PYTHON)架構。對應的也有LAMP,這個是基於Linux平臺的,大同小異,就不說了。php
首先須要下載一個bitnami的安裝包,下載地址:bitnami安裝包下載地址css
安裝的步驟很簡單,安裝好後出現一些目錄:html
能夠看到,安裝包包含了不少東西,apatche、mysql、php、sqlite等等。。。前端
對於快速測試和不熟一個php網頁到服務器,須要關心apatche二、apps這兩個文件夾。mysql
好比說咱們要部署一個test的應用到服務器。sql
1.首先建立目錄到apps中,這是必要的,並且是名稱、位置不能夠隨意改動的。其中data文件夾是可選的,本例子不含該文件夾apache
htdocs文件夾存放着頁面、css、js等各類網頁前端源文件;conf文件夾顧名思義存放配置文件;data存放數據服務器
2.建立conf中三個配置文件架構
httpd-app.cof內容以下:app
- <Directory "D:\Bitnami\wampstack-5.5.26-0/apps/test/htdocs">
- Options +FollowSymLinks
- AllowOverride None
- <IfVersion < 2.3 >
- Order allow,deny
- Allow from all
- </IfVersion>
- <IfVersion >= 2.3>
- Require all granted
- </IfVersion>
- </Directory>
<Directory "D:\Bitnami\wampstack-5.5.26-0/apps/test/htdocs">
Options +FollowSymLinks
AllowOverride None
<IfVersion < 2.3 >
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3>
Require all granted
</IfVersion>
</Directory>
httpd-prefix.conf內容以下:
- Alias /test/ "D:\Bitnami\wampstack-5.5.26-0/apps/test/htdocs/"
- Alias /test "D:\Bitnami\wampstack-5.5.26-0/apps/test/htdocs"
-
- Include "D:\Bitnami\wampstack-5.5.26-0/apps/test/conf/httpd-app.conf"
Alias /test/ "D:\Bitnami\wampstack-5.5.26-0/apps/test/htdocs/"
Alias /test "D:\Bitnami\wampstack-5.5.26-0/apps/test/htdocs"
Include "D:\Bitnami\wampstack-5.5.26-0/apps/test/conf/httpd-app.conf"
httpd-vhosts.conf內容以下:
- <VirtualHost *:80>
- ServerName test.example.com
- DocumentRoot "D:\Bitnami\wampstack-5.5.26-0/apps/test/htdocs"
- Include "D:\Bitnami\wampstack-5.5.26-0/apps/test/conf/httpd-app.conf"
- </VirtualHost>
<VirtualHost *:80>
ServerName test.example.com
DocumentRoot "D:\Bitnami\wampstack-5.5.26-0/apps/test/htdocs"
Include "D:\Bitnami\wampstack-5.5.26-0/apps/test/conf/httpd-app.conf"
</VirtualHost>
以上的三個文件,不一樣的應用須要根據不一樣的須要進行更改。
3.bitnami-apps-prefix.conf文件(/installdir/apache2/conf/bitnami/bitnami-apps-prefix.conf)結尾添加一行:
- Include "D:/Bitnami/wampstack-5.5.26-0/apps/test/conf/httpd-prefix.conf"
Include "D:/Bitnami/wampstack-5.5.26-0/apps/test/conf/httpd-prefix.conf"
這一行是對app中前綴解釋文件的一個全局聲明。
4.添加php文件,咱們添加了demo中的兩個php文件:
5.啓動bitnami
本文未涉及mysql的配置,以及其餘的(好比FastCgi)配置。
參考文檔:bitnami php部署參考文獻