debian7.5安裝apache2搭建PHP開發環境的教程

來源:互聯網
上載者:User

使用以下命令,需要SSH登入伺服器,然後依次執行以下命令。
第一步:更新系統組件

apt-get update
apt-get upgrade –show-upgraded

第二步:安裝apache2

apt-get install apache2
啟動apache2的rewrite支援
a2enmod rewrite

第三步:建立網站,配置虛擬機器主機

建立網站的設定檔路徑在:/etc/apache2/sites-available/
使用 vim www_jicker_cn.conf 命令建立一個設定檔,然後使用shift+insert鍵插入如下設定檔
<VirtualHost *:80>
ServerAdmin admin@111cn.net
ServerName 111cn.net
ServerAlias www.111cn.net
DocumentRoot /www/www_jicker_cn/public_html/
ErrorLog  /www/www_jicker_cn/logs/error.log
CustomLog /www/www_jicker_cn/logs/access.log combined
</VirtualHost>

第四步:建立網站目錄和日誌目錄

mkdir -p /www/www_jicker_cn/public_html
mkdir /www/www_jicker_cn/logs

第五步:執行命令啟動網站

a2ensite www_jicker_cn.conf

第六步:重新啟動apache2

service apache2 restart

第七步:最佳化apache2的配置

使用vim /etc/apache2/apache2.conf 命令編輯apache2的設定檔
<IfModule mpm_prefork_module>
StartServers 2
MinSpareServers 6
MaxSpareServers 12
MaxClients 80
MaxRequestsPerChild 3000
</IfModule>

總結

apache作為後端服務,抗壓能力比nginx差好多。更多的最佳化配置就不提供了,推薦在正式生產環境還是上nginx吧。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.