更新源:apt-get update
升級軟體:apt-get upgrade
更新系統:apt-get dist-upgrade
apt-get install openssl
apt-get install libssl-dev
yum -y install openssl openssl-devel
groupadd www-data
useradd -g www-data www-data
以上亂扯可能會用到
下載 zlib pcre openssl
./configure --prefix=/usr/local/tengine --user=www-data --group=www-data --with-zlib=/home/zlib-1.2.8 --with-pcre=/home/pcre-8.36 --with-openssl=/home/openssl-1.0.1k
(這裡的 zlib pcre 和 openssl 都是下載的 檔案解壓後的路徑)
Configuration summary
+ using PCRE library: /home/pcre-8.36
+ using OpenSSL library: /home/openssl-1.0.1k
+ md5: using OpenSSL library
+ sha1: using OpenSSL library
+ using zlib library: /home/zlib-1.2.8
+ jemalloc library is disabled
nginx path prefix: "/usr/local/tengine"
nginx binary file: "/usr/local/tengine/sbin/nginx"
nginx configuration prefix: "/usr/local/tengine/conf"
nginx configuration file: "/usr/local/tengine/conf/nginx.conf"
nginx pid file: "/usr/local/tengine/logs/nginx.pid"
nginx error log file: "/usr/local/tengine/logs/error.log"
nginx http access log file: "/usr/local/tengine/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx dso module path: "/usr/local/tengine/modules/"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
要啟動nginx,直接執行/usr/local/nginx/sbin/nginx命令即可。一旦nginx啟動後,便可以通過nginx加-s參數調用來控制它。使用的文法格式為:
nginx -s signal
其中signal可以為如下參數的一種:
* stop 快速關閉
* quit 優雅的關閉
* reload 重新載入設定檔
* reopen 重新開啟log檔案
修改PATH 變數 使 替換 #/usr/local/nginx/sbin/nginx # nginx
修改 /etc/profile 最後添加一行
export PATH=/usr/local/tengine/sbin:$PATH
//重啟
source /etc/profile
添加開機啟動
echo "/usr/local/tengine/sbin/nginx" >>/etc/rc.local
以上就介紹了ubuntu 編譯安裝 nginx,包括了方面的內容,希望對PHP教程有興趣的朋友有所協助。