[root@lnmp software]# tar zxvf nginx-1.4.4.tar.gz
[root@lnmp software]# cd nginx-1.4.4
[root@lnmp nginx-1.4.4]# ./configure --prefix=/service/nginx --with-http_ssl_module --with-pcre --with-http_spdy_module --with-http_stub_status_module --with-pcre --user=webroot --group=webroot
........................
Configuration summary
+ using system PCRE library
+ using system OpenSSL library
+ md5: using OpenSSL library
+ sha1: using OpenSSL library
+ using system zlib library
nginx path prefix: "/service/nginx"
nginx binary file: "/service/nginx/sbin/nginx"
nginx configuration prefix: "/service/nginx/conf"
nginx configuration file: "/service/nginx/conf/nginx.conf"
nginx pid file: "/service/nginx/logs/nginx.pid"
nginx error log file: "/service/nginx/logs/error.log"
nginx http access log file: "/service/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
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"
[root@lnmp nginx-1.4.4]# make && make install
配置nginx
[plain] view plaincopyprint?
[root@lnmp conf]# cat /service/nginx/conf/nginx.conf
user webroot webroot;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
index index.php index.html index.shtml index.htm;
root /service/nginx/html;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ .*\.(php)?$
{
expires -1s;
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/var/run/phpfpm.sock;
#php-fpm.conf listen = /var/run/phpfpm.sock##
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
[root@lnmp conf]# /service/nginx/sbin/nginx -t
nginx: the configuration file /service/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /service/nginx/conf/nginx.conf test is successful
[root@lnmp conf]# cat /service/nginx/conf/nginx.conf
user webroot webroot;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;