一步一步把WampServer裝好裝滿
今天有點時間要來介紹另一套免費的架站軟體整合包WampServer
下載:https://sourceforge.net/projects/wampserver/files/WampServer%203/WampServer%203.0.0/
安裝前請先看這篇:
http://forum.wampserver.com/read.php?2,138295
https://wampserver.aviatechno.net/
只支援NTFS格式,並把需要裝的前置程式都裝好
Microsoft Visual C/C++ Redistributable 2008 (VC9),
Microsoft Visual C/C++ Redistributable 2010 (VC10),
Microsoft Visual C/C++ Redistributable 2012 (VC11),
Microsoft Visual C/C++ Redistributable 2013 (VC13),
Microsoft Visual C/C++ Redistributable 2015 (VC14),
Microsoft Visual C/C++ Redistributable 2017 (VC15)
啟動前先停止iis服務,並設開機時不啟動
Wamp安裝好後的程式介面
資料庫預設帳號為root,密碼為空,請記得去設定
http://localhost/phpmyadmin/
新增網站:http://localhost/add_vhost.php
重啟Apache,現在網站在本機已經可以看到了
但其他電腦連線進來看的話會出現
Forbidden
You don't have permission to access / on this server.
除了設定好防火牆(80,443),我們還要編輯httpd-vhosts.conf檔(wamp64\bin\apache\apache2.4.46\conf\extra)
<VirtualHost *:80>
ServerName www.yourname.com.tw
DocumentRoot "e:/wamp64/www/webs/www.yourname.com.tw"
<Directory "e:/wamp64/www/webs/www.yourname.com.tw/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
改成
<VirtualHost *:80>
ServerNamewww.yourname.com.tw
DocumentRoot "e:/wamp64/www/webs/www.yourname.com.tw"
<Directory "e:/wamp64/www/webs/www.yourname.com.tw/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
require all granted
</Directory>
</VirtualHost>
然後重啟服務,其他電腦就可以連線了
WampServer SSL設定
請先申請SSL
將下載的三個檔更改檔名為yourssl,放在E:\wamp64\bin\apache\apache2.4.33\conf\
編輯httpd.conf,將這三行前面的註解拿掉
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
LoadModule ssl_module modules/mod_ssl.so
Include conf/extra/httpd-ssl.conf
編輯httpd-ssl.conf
以下兩行,請放上對應的crt與key
SSLCertificateFile "${SRVROOT}/conf/server.crt"
SSLCertificateKeyFile "${SRVROOT}/conf/server.key"
最後一行加上
<VirtualHost *:443>
ServerName www.yourname.com.tw:443
DocumentRoot "e:/wamp64/www/webs/www.yourname.com.tw"
<Directory "e:/wamp64/www/webs/www.yourname.com.tw/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
require all granted
</Directory>
SSLEngine on
SSLCertificateFile "E:/wamp64/bin/apache/apache2.4.33/conf/yourssl.crt"
SSLCertificateKeyFile "E:/wamp64/bin/apache/apache2.4.33/conf/yourssl.key"
SSLCACertificateFile "E:/wamp64/bin/apache/apache2.4.33/conf/yourssl_ca_bundle.crt"
</VirtualHost>
重啟服務
網站Log分別紀錄
編輯httpd-vhosts.conf或是httpd-ssl.conf
1 | CustomLog "|e:/wamp64/bin/apache/apache2.4.33/bin/rotatelogs.exe e:/wamp64/logs/www.yourname.com.tw/access.log-%m-%d 86400" common ErrorLog "|e:/wamp64/bin/apache/apache2.4.33/bin/rotatelogs.exe e:/wamp64/logs/www.yourname.com.tw/error.log-%m-%d 86400" |
觀察server-status
編輯httpd.conf
開啟 mod_info.so
開啟 mod_status.so
開啟 httpd-info.conf
服務重啟
瀏覽器輸入http://127.0.0.1/server-status?refresh=5
設定Wampserver開機自動啟動
Maximum execution time of 360 seconds exceeded
在匯入sql檔時出現以上這個訊息!
請編輯 wamp64\alias\phpmyadmin.conf
php_admin_value max_execution_time 720
php_admin_value max_input_time 720
MySQL server has gone away
編輯my.ini檔
wait_timeout = 28800
innodb_log_file_size = 512MB
max_allowed_packet = 512M
errors were found during analysis. Missing expression. near “ON” at position 25
在匯入sql檔時出現以上這個訊息!
編輯 php.ini
max_execution_time = 600
max_input_time = 600
memory_limit = 1024M
編輯my.ini檔
max_allowed_packet = 512M
網頁不要顯示php error
編輯php.ini
display_errors = Off
display_startup_errors = Off
track_errors = Off
設定上傳檔案大小
預設是8MB,根據版本編輯裡面資料夾裡的php.ini,調整為20MB
post_max_size = 20M
upload_max_filesize = 20M
設定記憶體上限
編輯php.ini
memory_limit = 256M
使用command 重啟WAMP
NET STOP wampapache64
NET START wampapache64
或是E:\wamp64\bin\apache\apache2.4.33\bin>httpd.exe -k restart -n wampapache64
下載bat檔:https://www.dropbox.com/s/7cennjowruok8am/restart-wamp.bat?dl=0
推薦最快速穩定便宜的share hosting主機
發表評論
想要留言嗎?歡迎歡迎!