nginx+PHP

user-pic
Vote 0 Votes

nginx (發音 engine) 近幾年因為性能卓越, 市佔已愈來愈高, 僅次於 Apache, IIS, 排第三
官方有提供 Prebuilt Packages, 安裝很方便
Create /etc/yum.repos.d/nginx.repo

yum -y install nginx

PHP 在 configure 需加 --enable-fpm 參數
設定檔用預設的即可 cp sapi/fpm/php-fpm.conf /usr/local/etc/php-fpm.conf
執行 php-fpm 會 Listen 9000 Port
nginx 設定檔 /etc/nginx/conf.d/default.conf
這是 HTTP + HTTPS + PHP 的典型設定, DocumentRoot 在 /var/www/html
若 SSL 憑證是用 Let's Encrypt, ssl_certificate 這個參數要把這兩個檔合併 cert.pem, chain.pem
cat cert.pem chain.pem > cert_chain.pem
若只有 cert.pem 的內容, 試過一般瀏覽器可以正常, 但是 curl, wget, links, lynx, w3m 等 CLI 工具都會出現錯誤
curl: (60) Peer certificate cannot be authenticated with known CA certificates
wget: ERROR: The certificate of 'yourhost.com' is not trusted.
links: SSL error
lynx: SSL error:unable to get local issuer certificate
w3m: unable to get local issuer certificate
ERROR: The certificate of 'yourhost.com' hasn't got a known issuer.

ref. Install NGINX

About this Entry

This page contains a single entry by Pank published on May 24, 2016 1:24 AM.

openssl s_client was the previous entry in this blog.

JSON formating is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Monthly Archives