WinNMP(WTserver)安裝設定教學 (Nginx)
先介紹一下WinNMP以前是叫WTserver。
如何設定 MariaDB root 密碼?
In order to set mysql(mariadb)
1 | root |
password, open a command prompt and type
1 | C:\WinNMP\bin\MySql\bin\mysqladmin -u root password NEWPASSWORD |
重啟WTserver
Nginx出現413 Request Entity Too Large
編輯 nginx.conf
client_max_body_size 50m;
使用WP一些建議的設定
編輯 php.ini
post_max_size = 30M
max_execution_time = 300
max_input_time = 150
memory_limit = 256M
upload_max_filesize = 30M
max_file_uploads = 100
How to allow access from LAN and Internet to your local project
編輯 projectName.conf
server {
listen 127.0.0.1:80;
listen *:80;
server_name projectName.test projectName.com projectName.myDomain.com;
### Access Restrictions
allow all;
## deny all;
How to set expires headers
編輯 projectName.conf
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 30d;
log_not_found off;
}
enable exec()
編輯 php.ini
找到 disable_functions
把exec拿掉
解決 Nginx 下修改 WordPress 固定連結後導致文章跳出404
在站台的conf檔,在Server{}中加入以下程式碼:
1 2 3 4 5 6 7 8 9 | if (-f $request_filename/index.html){ rewrite (.*) $1/index.html break; } if (-f $request_filename/index.php){ rewrite (.*) $1/index.php; } if (!-f $request_filename){ rewrite (.*) /index.php; } |
開啟Gzip
編輯 nginx.conf
gzip on;
gzip_min_length 1100;
gzip_buffers 4 32k;
gzip_types text/plain application/x-javascript text/xml text/css;
gzip_vary on;
成功的話,網站首頁如下圖:
WinNMP如何升級
建議還是先做好備份
請直接下載最新的安裝檔,執行安裝
在升級過程中,所有原本的數據庫、設置、都會保留。
HTTP強制重定向至HTTPS
編輯站台的conf檔
1 2 3 4 5 6 7 8 9 | server { listen 80; ... return 301 https://$server_name$request_uri; } server { listen 443; ... } |
發表評論
想要留言嗎?歡迎歡迎!