【必须把所有下载的gz文件到放到机器上;编译】

1.安装nginx之前的编译软件

yum -y install make zlib zlib-devel gcc-c++ libtool  openssl openssl-devel

make 命令安装

zlib 和 zlib-devel 解压命令安装:

red hat:wget https://sourceforge.net/projects/libpng/files/zlib/1.2.8/zlib-1.2.8.tar.gz/download -o zlib-1.2.8.tar.gz
ubuntu:apt install zlib1g gcc 的安装
g++ 的安装 libtool 通用库工具的安装
ubuntu:sudo apt install libtool
Ubuntu:sudo apt-get install zlib1g-dev
Ubuntu:sudo apt-get install g++
openssl 一个安全套接字层密码库

二、首先要安装 PCRE

PCRE 作用是让 Nginx 支持 Rewrite 功能。

1、下载 PCRE 安装包,下载地址:wget http://downloads.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz

daokr#wget http://downloads.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz

2、解压安装包:

[root@dksrc]# tar zxvf pcre-8.33.tar.gz

3、进入安装包目录

[root@dksrc]# cd pcre-8.33

4、编译安装

[root@dkpcre-8.35]# ./configure --prefix=/usr/local/src/pcre-8.33
[root@dkpcre-8.35]# make && make install

查找pcre 的默认安装路径

root@VM---ubuntu:/# find -name pcre
./home/ubuntu/downfile/nginx-1.5./auto/lib/pcre

如果报错看下面链接:

ubuntu编译PCRE时出现 line 81: aclocal-1.14: command not found错误

 

5、查看pcre版本

[root@dkpcre-8.35]# pcre-config --version

 

安装openssl

1.下载地址

root:wget https://www.openssl.org/source/openssl-1.0.2h.tar.gz

2.编辑配置安装路径

root:./config --prefix=/usr/local/src/openss-1.0

3.输入make && make install 安装

make && make install

4.查看版本

daokr#openssl version -a

安装 Nginx

1、下载 Nginx,下载地址:http://nginx.org/download/nginx-1.5.8.tar.gz

[root@dk src]#wget http://nginx.org/download/nginx-1.5.8.tar.gz

2、解压安装包

[root@dksrc]# tar zxvf nginx-1.5.8.tar.gz

3、进入安装包目录

[root@dksrc]# cd nginx-1.5.8

4、编译安装

[root@dknginx-1.6.2]# ./configure --prefix=/home/nginx --with-http_stub_status_module --with-http_ssl_module --with-openssl=/home/daokr/downfile/openssl-1.0.2h --with-pcre=/home/daokr/downfile/pcre-8.33
[root@dknginx-1.6.2]# make
[root@dknginx-1.6.2]# make install 在编译的时候如果没有出现 creating objs/Makefile 这行;说明哪里错了;要按错误来修改
这里有个坑;就是 --with-openssl和--with-pcre 的路径 是压缩包解压后源文件;千万别搞错了路径

5、查看nginx版本

[root@dknginx-1.6.2]# /usr/local/webserver/nginx/sbin/nginx -v

到此,nginx安装完成。

Nginx 配置

创建 Nginx 运行使用的用户 www:

添加用户组www

添加用户并赋予www的权限组

[root@dk conf]# groupadd www 
[root@dk conf]# useradd -g www www

配置nginx.conf ,将/usr/local/webserver/nginx/conf/nginx.conf替换为以下内容

默认配置:

启动地址:/usr/sbin/nginx 下面关闭

root@DK:/usr/sbin# ./nginx
root@DK:/usr/sbin# ps -ef|grep nginx
root : ? :: nginx: master process ./nginx
www : ? :: nginx: worker process
root : pts/ :: grep --color=auto nginx

测试配置是否正确命令:

root@DK:/etc/nginx# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

启动和停用:

Nginx 其他命令
以下包含了 Nginx 常用的几个命令:
/usr/local/webserver/nginx/sbin/nginx -s reload # 重新载入配置文件
/usr/local/webserver/nginx/sbin/nginx -s reopen # 重启 Nginx
/usr/local/webserver/nginx/sbin/nginx -s stop # 停止 Nginx

 安装完成后简单的修改下配置文件:

user  www www;
worker_processes 1; #error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; #pid logs/nginx.pid; events {
worker_connections 1024;
} http {
include mime.types;
default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on;
#tcp_nopush on; #keepalive_timeout 0;
keepalive_timeout 65; #gzip on; server {
listen 1180;
server_name localhost; #charset koi8-r; #access_log logs/host.access.log main;
set $root_path "/home/daokr/web"; root $root_path;
index index.php index.html index.htm;
location / {
root html;
index index.html index.htm;
} #error_page 404 /404.html; # redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
} # proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#} # deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
} # another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias; # location / {
# root html;
# index index.html index.htm;
# }
#} # HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost; # ssl_certificate cert.pem;
# ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on; # location / {
# root html;
# index index.html index.htm;
# }
#} }

下面是工作的实际的nginx配置:

#user oracle.dba;
worker_processes ;
worker_cpu_affinity ;
pid /home/nginx/logs/nginx.pid; #Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile ; events
{
use epoll;
worker_connections ;
} http
{
include mime.types;
default_type application/octet-stream; server_tokens off;
server_names_hash_bucket_size ;
client_header_buffer_size 4k;
large_client_header_buffers 32k;
client_max_body_size 64m;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 60s; open_file_cache max= inactive=20s;
open_file_cache_valid 60s;
open_file_cache_min_uses ; fastcgi_connect_timeout 180s;
fastcgi_send_timeout 180s;
fastcgi_read_timeout 180s; fastcgi_buffer_size 64k;
fastcgi_buffers 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k; proxy_connect_timeout 180s;
proxy_read_timeout 180s;
proxy_send_timeout 180s; proxy_buffer_size 64k;
proxy_buffers 64k;
proxy_busy_buffers_size 128k; gzip on;
gzip_min_length 1k;
gzip_buffers 64k;
gzip_http_version 1.0;
gzip_comp_level ;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on; include server/*.txt; #access loger format
log_format access '$remote_addr $http_x_forwarded_for $remote_user [$time_local] "$request" [$request_length/$bytes_sent] '
'$status "$http_referer" "$http_user_agent"';
access_log logs/access.log access;
log_not_found off;
open_log_file_cache max=1000 inactive=20s valid=1m min_uses=2; error_log /home/nginx/logs/error.log error; # limit_zone crawler;
# $binary_remote_addr 10m; #WebSocket Upgrade
#map $http_upgrade $connection_upgrade
#{
# default upgrade;
# '' close;
#} #server
#{
# #WebSocket Proxy Port
# listen 12800;
# server_name localhost;
#
# location /
# {
# #PHP WebSocket port
# proxy_pass http://localhost:12801;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header Host $host;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection "upgrade";
# }
#} server
{
##---xpass-1.0.0---##
listen 20030;
server_name localhost;
charset utf-8; ##ssl configure
#ssl on;
#ssl_certificate cert/lianyinggufen_com.crt;
#ssl_certificate_key cert/lianyinggufen_com.key;
#ssl_session_timeout 5m;
#ssl_protocols SSLv3 TLSv1;
#ssl_ciphers HIGH:!ADH:!EXPORT56:RC4+RSA:+MEDIUM;
#ssl_prefer_server_ciphers on; ## phalcon-config
set $root_path "/home/oracle/xpass-1.0.0/public"; root $root_path;
index index.php index.html index.htm;
try_files $uri $uri/ @rewrite; #for document_root - ajax request
location /
{
rewrite ^(.*)$ /index.php?_url=$1;
} #for all others
location @rewrite
{
rewrite ^/(.*)$ /index.php?_url=$1;
} location ~ \.php
{
# try_files $uri = 404;
fastcgi_index index.php; # fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/tmp/php-cgi.sock; include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
} # cache folder
# location ~* ^/(js|css|img|images|flv|swf|fonts|download)/(.+)$ # cache file type
location ~* .(js|css|jpg|jpeg|gif|png|flv|swf|ttf|svg|eot|woff|apk|ipa|plist)$
{
root $root_path;
access_log off;
expires 30d;
} location ~ \.ico
{
root $root_path;
access_log off;
expires 30d;
} location ~ /\.ht
{
deny all;
}
} server
{
##---xpay-1.0.0(http)---##
listen 20031;
server_name localhost;
charset utf-8; ## phalcon-config
set $root_path "/home/oracle/xpay-1.0.0/public"; root $root_path;
index index.php index.html index.htm;
try_files $uri $uri/ @rewrite; #for document_root - ajax request
location /
{
rewrite ^(.*)$ /index.php?_url=$1;
} #for all others
location @rewrite
{
rewrite ^/(.*)$ /index.php?_url=$1;
} location ~ \.php
{
# try_files $uri = 404;
fastcgi_index index.php; # fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/tmp/php-cgi.sock; include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
} # cache folder
# location ~* ^/(.+)/(js|css|img|images|flv|swf|fonts|download|product)/(.+)$ # cache file type
location ~* .(js|css|jpg|jpeg|gif|png|flv|swf|ttf|svg|eot|woff|download|xlsx|zip|uploads|xml|rar)$
{
root $root_path;
access_log off;
expires 30d;
} location ~ \.ico
{
root $root_path;
access_log off;
expires 30d;
} location ~ /\.ht
{
deny all;
}
}
#
# server
# {
# ##---wxqyh---##
# listen 20038;
# server_name localhost;
# charset utf-8;
#
# ## phalcon-config
# set $root_path "/home/oracle/wxqyh-1.0.0/public";
#
# root $root_path;
# index index.php index.html index.htm;
# try_files $uri $uri/ @rewrite;
#
# #for document_root - ajax request
# location /
# {
# rewrite ^(.*)$ /index.php?_url=$1;
# }
#
# #for all others
# location @rewrite
# {
# rewrite ^/(.*)$ /index.php?_url=$1;
# }
#
# location ~ \.php
# {
# # try_files $uri = 404;
# fastcgi_index index.php;
#
# # fastcgi_pass 127.0.0.1:9000;
# fastcgi_pass unix:/tmp/php-cgi.sock;
#
# include fastcgi_params;
# fastcgi_split_path_info ^(.+\.php)(/.+)$;
# fastcgi_param PATH_INFO $fastcgi_path_info;
# fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# }
#
# # cache folder
# # location ~* ^/(.+)/(js|css|img|images|flv|swf|fonts|download|product)/(.+)$
#
# # cache file type
# location ~* .(js|css|jpg|jpeg|gif|png|flv|swf|ttf|svg|eot|woff|download|xlsx)$
# {
# root $root_path;
# access_log off;
# expires 30d;
# }
#
# location ~ \.ico
# {
# root $root_path;
# access_log off;
# expires 30d;
# }
#
# location ~ /\.ht
# {
# deny all;
# }
# }
#
server
{
##---xmer-1.0.0---##
listen 20033;
server_name localhost;
charset utf-8; ## phalcon-config
set $root_path "/home/oracle/xmer-1.0.0/public"; root $root_path;
index index.php index.html index.htm;
try_files $uri $uri/ @rewrite; #for document_root - ajax request
location /
{
rewrite ^(.*)$ /index.php?_url=$1;
} #for all others
location @rewrite
{
rewrite ^/(.*)$ /index.php?_url=$1;
} location ~ \.php
{
# try_files $uri = 404;
fastcgi_index index.php; # fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/tmp/php-cgi.sock; include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
} # cache folder
# location ~* ^/(js|css|img|images|flv|swf|fonts|download)/(.+)$ # cache file type
location ~* .(js|css|jpg|jpeg|gif|png|flv|swf|ttf|svg|eot|woff|download|xlsx)$
{
root $root_path;
access_log off;
expires 30d;
} location ~ \.ico
{
root $root_path;
access_log off;
expires 30d;
} location ~ /\.ht
{
deny all;
}
} server
{
##---xagent-1.0.0---##
listen 20034;
server_name localhost;
charset utf-8; ## phalcon-config
set $root_path "/home/oracle/xagent-1.0.0/public"; root $root_path;
index index.php index.html index.htm;
try_files $uri $uri/ @rewrite; #for document_root - ajax request
location /
{
rewrite ^(.*)$ /index.php?_url=$1;
} #for all others
location @rewrite
{
rewrite ^/(.*)$ /index.php?_url=$1;
} location ~ \.php
{
# try_files $uri = 404;
fastcgi_index index.php; # fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/tmp/php-cgi.sock; include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
} # cache folder
# location ~* ^/(js|css|img|images|flv|swf|fonts|download)/(.+)$ # cache file type
location ~* .(js|css|jpg|jpeg|gif|png|flv|swf|ttf|svg|eot|woff|download|xlsx)$
{
root $root_path;
access_log off;
expires 30d;
} location ~ \.ico
{
root $root_path;
access_log off;
expires 30d;
} location ~ /\.ht
{
deny all;
}
} server
{
##---xserv-1.0.0---##
listen 20035;
server_name localhost;
charset utf-8; ## phalcon-config
set $root_path "/home/oracle/xserv-1.0.0/public"; root $root_path;
index index.php index.html index.htm;
try_files $uri $uri/ @rewrite; #for document_root - ajax request
location /
{
rewrite ^(.*)$ /index.php?_url=$1;
} #for all others
location @rewrite
{
rewrite ^/(.*)$ /index.php?_url=$1;
} location ~ \.php
{
# try_files $uri = 404;
fastcgi_index index.php; # fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/tmp/php-cgi.sock; include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
} # cache folder
# location ~* ^/(js|css|img|images|flv|swf|fonts|download)/(.+)$ # cache file type
location ~* .(js|css|jpg|jpeg|gif|png|flv|swf|ttf|svg|eot|woff|download|xlsx)$
{
root $root_path;
access_log off;
expires 30d;
} location ~ \.ico
{
root $root_path;
access_log off;
expires 30d;
} location ~ /\.ht
{
deny all;
}
} server
{
##---xfinance-1.0.0---##
listen 20036;
server_name localhost;
charset utf-8; ## phalcon-config
set $root_path "/home/oracle/xfinance-1.0.0/public"; root $root_path;
index index.php index.html index.htm;
try_files $uri $uri/ @rewrite; #for document_root - ajax request
location /
{
rewrite ^(.*)$ /index.php?_url=$1;
} #for all others
location @rewrite
{
rewrite ^/(.*)$ /index.php?_url=$1;
} location ~ \.php
{
# try_files $uri = 404;
fastcgi_index index.php; # fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/tmp/php-cgi.sock; include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
} # cache folder
# location ~* ^/(js|css|img|images|flv|swf|fonts|download)/(.+)$ # cache file type
location ~* .(js|css|jpg|jpeg|gif|png|flv|swf|ttf|svg|eot|woff|download|xlsx)$
{
root $root_path;
access_log off;
expires 30d;
} location ~ \.ico
{
root $root_path;
access_log off;
expires 30d;
} location ~ /\.ht
{
deny all;
}
} server
{
##---xapp-1.0.0 SSL---##
listen 20037;
server_name localhost;
charset utf-8; ##ssl configure
ssl on;
ssl_certificate ssl/boshang.crt;
ssl_certificate_key ssl/boshang.key;
ssl_session_timeout 5m;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers HIGH:!ADH:!EXPORT56:RC4+RSA:+MEDIUM;
ssl_prefer_server_ciphers on; ## phalcon-config
set $root_path "/home/oracle/xapp-1.0.0/public"; root $root_path;
index index.php index.html index.htm;
try_files $uri $uri/ @rewrite; #for document_root - ajax request
location /
{
rewrite ^(.*)$ /index.php?_url=$1;
} #for all others
location @rewrite
{
rewrite ^/(.*)$ /index.php?_url=$1;
} location ~ \.php
{
# try_files $uri = 404;
fastcgi_index index.php; # fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/tmp/php-cgi.sock; include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
} # cache folder
# location ~* ^/(js|css|img|images|flv|swf|fonts|download)/(.+)$ # cache file type
location ~* .(js|css|jpg|jpeg|gif|png|flv|swf|ttf|svg|eot|woff|download|xlsx|exe|app|appfile)$
{
root $root_path;
access_log off;
expires 30d;
} location ~ \.ico
{
root $root_path;
access_log off;
expires 30d;
} location ~ /\.ht
{
deny all;
}
} server
{
##---xapp-1.0.0 not ssl---##
listen 20042;
server_name localhost;
charset utf-8; ## phalcon-config
set $root_path "/home/oracle/xapp-1.0.0/public"; root $root_path;
index index.php index.html index.htm;
try_files $uri $uri/ @rewrite; #for document_root - ajax request
location /
{
rewrite ^(.*)$ /index.php?_url=$1;
} #for all others
location @rewrite
{
rewrite ^/(.*)$ /index.php?_url=$1;
} location ~ \.php
{
# try_files $uri = 404;
fastcgi_index index.php; # fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/tmp/php-cgi.sock; include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
} # cache folder
# location ~* ^/(js|css|img|images|flv|swf|fonts|download)/(.+)$ # cache file type
location ~* .(js|css|jpg|jpeg|gif|png|flv|swf|ttf|svg|eot|woff|download|xlsx)$
{
root $root_path;
access_log off;
expires 30d;
} location ~ \.ico
{
root $root_path;
access_log off;
expires 30d;
} location ~ /\.ht
{
deny all;
}
} server
{
##---XOPEN-1.0.0---##
listen 20041;
server_name localhost;
charset utf-8; ## phalcon-config
set $root_path "/home/oracle/xopen-1.0/public"; root $root_path;
index index.php index.html index.htm;
try_files $uri $uri/ @rewrite; #for document_root - ajax request
location /
{
rewrite ^(.*)$ /index.php?_url=$1;
} #for all others
location @rewrite
{
rewrite ^/(.*)$ /index.php?_url=$1;
} location ~ \.php
{
# try_files $uri = 404;
fastcgi_index index.php; # fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/tmp/php-cgi.sock; include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
} # cache folder
# location ~* ^/(.+)/(js|css|img|images|flv|swf|fonts|download|product)/(.+)$ # cache file type
location ~* .(js|css|jpg|jpeg|gif|png|flv|swf|ttf|svg|eot|woff|download|xlsx)$
{
root $root_path;
access_log off;
expires 30d;
} location ~ \.ico
{
root $root_path;
access_log off;
expires 30d;
} location ~ /\.ht
{
deny all;
}
} server
{
##---XOPEN-1.0.0---##
listen 20046;
server_name localhost;
charset utf-8; ## phalcon-config
set $root_path "/home/oracle/xdemo"; root $root_path;
index index.php index.html index.htm;
#try_files $uri $uri/ @rewrite; #for document_root - ajax request
location /
{
#rewrite ^(.*)$ /index.php?_url=$1;
} #for all others
location @rewrite
{
#rewrite ^/(.*)$ /index.php?_url=$1;
} location ~ \.php
{
# try_files $uri = 404;
fastcgi_index index.php; # fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/tmp/php-cgi.sock; include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
} # cache folder
# location ~* ^/(.+)/(js|css|img|images|flv|swf|fonts|download|product)/(.+)$ # cache file type
location ~* .(js|css|jpg|jpeg|gif|png|flv|swf|ttf|svg|eot|woff|download|xlsx|html|htm|http)$
{
root $root_path;
access_log off;
expires 30d;
} location ~ \.ico
{
root $root_path;
access_log off;
expires 30d;
} location ~ /\.ht
{
deny all;
}
} #server
#{
# ##---xweixin-1.0.0---##
# listen 20041;
# server_name localhost;
# charset utf-8;
#
# ## phalcon-config
# set $root_path "/home/oracle/xweixin-1.0.0/public";
#
# root $root_path;
# index index.php index.html index.htm;
# try_files $uri $uri/ @rewrite;
#
# #for document_root - ajax request
# location /
# {
# rewrite ^(.*)$ /index.php?_url=$1;
# }
#
# #for all others
# location @rewrite
# {
# rewrite ^/(.*)$ /index.php?_url=$1;
# }
#
# location ~ \.php
# {
# # try_files $uri = 404;
# fastcgi_index index.php;
#
# # fastcgi_pass 127.0.0.1:9000;
# fastcgi_pass unix:/tmp/php-cgi.sock;
#
# include fastcgi_params;
# fastcgi_split_path_info ^(.+\.php)(/.+)$;
# fastcgi_param PATH_INFO $fastcgi_path_info;
# fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# }
#
# # cache folder
# # location ~* ^/(.+)/(js|css|img|images|flv|swf|fonts|download|product)/(.+)$
#
# # cache file type
# location ~* .(js|css|jpg|jpeg|gif|png|flv|swf|ttf|svg|eot|woff|download|xlsx)$
# {
# root $root_path;
# access_log off;
# expires 30d;
# }
#
# location ~ \.ico
# {
# root $root_path;
# access_log off;
# expires 30d;
# }
#
# location ~ /\.ht
# {
# deny all;
# }
#}
#
#server
#{
# ##---xca-1.0.0---##
# listen 20044;
# server_name localhost;
# charset utf-8;
#
# ## phalcon-config
# set $root_path "/home/oracle/xca-1.0.0/public";
#
# root $root_path;
# index index.php index.html index.htm;
# try_files $uri $uri/ @rewrite;
#
# #for document_root - ajax request
# location /
# {
# rewrite ^(.*)$ /index.php?_url=$1;
# }
#
# #for all others
# location @rewrite
# {
# rewrite ^/(.*)$ /index.php?_url=$1;
# }
#
# location ~ \.php
# {
# # try_files $uri = 404;
# fastcgi_index index.php;
#
# # fastcgi_pass 127.0.0.1:9000;
# fastcgi_pass unix:/tmp/php-cgi.sock;
#
# include fastcgi_params;
# fastcgi_split_path_info ^(.+\.php)(/.+)$;
# fastcgi_param PATH_INFO $fastcgi_path_info;
# fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# }
#
# # cache folder
# # location ~* ^/(.+)/(js|css|img|images|flv|swf|fonts|download|product)/(.+)$
#
# # cache file type
# location ~* .(js|css|jpg|jpeg|gif|png|flv|swf|ttf|svg|eot|woff|download|xlsx)$
# {
# root $root_path;
# access_log off;
# expires 30d;
# }
#
# location ~ \.ico
# {
# root $root_path;
# access_log off;
# expires 30d;
# }
#
# location ~ /\.ht
# {
# deny all;
# }
#} server
{
##---xwebs---##
listen 20044;
server_name localhost;
charset utf-8; ## phalcon-config
set $root_path "/home/oracle/xwebs/public"; root $root_path;
index index.php index.html index.htm;
try_files $uri $uri/ @rewrite; #for document_root - ajax request
location /
{
rewrite ^(.*)$ /index.php?_url=$1;
} #for all others
location @rewrite
{
rewrite ^/(.*)$ /index.php?_url=$1;
} location ~ \.php
{
# try_files $uri = 404;
fastcgi_index index.php; # fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/tmp/php-cgi.sock; include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
} # cache folder
# location ~* ^/(.+)/(js|css|img|images|flv|swf|fonts|download|product)/(.+)$ # cache file type
location ~* .(js|css|jpg|jpeg|gif|png|flv|swf|ttf|svg|eot|woff|download|xlsx)$
{
root $root_path;
access_log off;
expires 30d;
} location ~ \.ico
{
root $root_path;
access_log off;
expires 30d;
} location ~ /\.ht
{
deny all;
}
} server
{
##---xcar-1.0.0 SSL---##
listen 20050;
server_name localhost;
charset utf-8; ##ssl configure
ssl on;
ssl_certificate ssl/xcar.cer;
ssl_certificate_key ssl/xcar.pem;
ssl_session_timeout 5m;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers HIGH:!ADH:!EXPORT56:RC4+RSA:+MEDIUM;
ssl_prefer_server_ciphers on; ## phalcon-config
set $root_path "/home/oracle/xcars-1.0.0/public"; root $root_path;
index index.php index.html index.htm;
try_files $uri $uri/ @rewrite; #for document_root - ajax request
location /
{
rewrite ^(.*)$ /index.php?_url=$1;
} #for all others
location @rewrite
{
rewrite ^/(.*)$ /index.php?_url=$1;
} location ~ \.php
{
# try_files $uri = 404;
fastcgi_index index.php; # fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/tmp/php-cgi.sock; include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
} # cache folder
# location ~* ^/(js|css|img|images|flv|swf|fonts|download)/(.+)$ # cache file type
location ~* .(js|css|jpg|jpeg|gif|png|flv|swf|ttf|svg|eot|woff|download|xlsx|exe|app|appfile)$
{
root $root_path;
access_log off;
expires 30d;
} location ~ \.ico
{
root $root_path;
access_log off;
expires 30d;
} location ~ /\.ht
{
deny all;
}
} server {
listen 5601;
server_name localhost;
charset utf8;
location / {
auth_basic "Restricted Access";
auth_basic_user_file /home/nginx/conf/htpasswd.users;
proxy_pass http://10.8.21.124:5601$request_uri;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
} } tcp
{
timeout 1d;
proxy_read_timeout 1d;
proxy_send_timeout 1d;
proxy_connect_timeout 14400; # ------ 192.168.2.11(oracle proxy) ------
upstream oracle_11521 {
server localhost:21521;
check interval=3000 rise=4 fall=5 timeout=3000 type=tcp;
}
server {
listen 11521;
proxy_pass oracle_11521;
so_keepalive on;
tcp_nodelay on;
}
}
 

Nginx 安装配置【必须把文件到放到机器上】的更多相关文章

  1. Nginx安装配置(转)

    Nginx 安装配置 Nginx("engine x")是一款是由俄罗斯的程序设计师Igor Sysoev所开发高性能的 Web和 反向代理 服务器,也是一个 IMAP/POP3/ ...

  2. Linux Nginx 安装配置

    安装前准备工作 GCC编译器-程序代码编译工具! 首先检验你的服务器环境是否安装gcc,方法如下: #gcc 如果出现:gcc: no input files 证明已经安装过gcc编译工具! 如果出现 ...

  3. nginx -- 安装配置Nginx

    安装说明 系统环境:CentOS-6.3 软件:nginx-1.2.6.tar.gz 安装方式:源码编译安装  安装位置:/usr/local/nginx  下载地址:http://nginx.org ...

  4. Nginx安装配置PHP(FastCGI)环境的教程

    这篇是Nginx安装配置PHP(FastCGI)环境的教程.Nginx不支持对外部程序的直接调用或者解析,所有的外部程序(包括PHP)必须通过FastCGI接口来调用. 一.什么是 FastCGI F ...

  5. Nginx安装配置与HelloWorld

    <深入理解Nginx>阅读与实践(一):Nginx安装配置与HelloWorld 最近在读陶辉的<深入理解Nginx:模块开发与架构解析>,一是想跟着大牛练练阅读和编写开源代码 ...

  6. Nginx 安装 配置 使用

    Nginx 安装 配置 使用 基本的HTTP服务器特性 处理静态文件,索引文件以及自动索引:打开文件描述符缓存(缓存元数据和文件描述符,下一次可以直接从内存找到数据或者文件的位置): 使用缓存加速反向 ...

  7. VMware Linux 下 Nginx 安装配置 - Tomcat 配置 (二)

    准备工作 相关浏览: VMware Linux 下 Nginx 安装配置 (一) 1. 选在 /usr/local/ 下创建 softs 文件夹,通过 ftp 命令 把 apache-tomcat-7 ...

  8. Hearbeat + Nginx 安装配置

    Hearbeat + Nginx 安装配置 实验环境 两台主机:Linux Centos 6.5 32位 主 服务端:Hearbeat + Nginx eth0:192.168.1.160(公网) e ...

  9. Nginx安装配置|Nginx反向代理|Nginx支持HTTPS|Nginx重定向

    Nginx安装配置 可以直接看到最下面的HTTPS. Nginx安装 我的系统如下: No LSB modules are available. Distributor ID: Ubuntu Desc ...

随机推荐

  1. jmeter_分布式测试

    背景:         由于Jmeter本身的瓶颈,当需要模拟数以千计的并发用户时,使用单台机器模拟所有的并发用户就有些力不从心,甚至还会引起JAVA内存溢出的错误.要解决这个问题,可以使用分布式实测 ...

  2. Java线程synchronized(一)

    线程安全概念:当多个线程访问某一个类(对象或方法)时,这个对象始终都能表现出正确的行为,那么这个类(对象或方法)就是线程安全的. synchronized:可以在任意对象及方法上加锁,而加锁的这段代码 ...

  3. vue刷新页面出现闪烁

    在容器里添加v-cloak <div class="box" id="call-no-list" v-cloak></div> 然后在c ...

  4. 利用脚本一键执行脚本,创建SharePoint文档库列表

    SharePoint基于文档库和列表上进行二次开发,生成新的文档库和新的列表模板 通过新的模板,创建新的文档库与列表 --定义site对象$site = SPSite http://dvt176/si ...

  5. 让table中的td不会被过长的文字撑开,并且自动出现省略号

    <style type="text/css"> table {width:600px;table-layout:fixed;} td {white-space:nowr ...

  6. 有关Nodejs的一些插件介绍

    var child_process = require('child_process');这个可以执行cmd的命令 child_process.exec(cmdLine, function(error ...

  7. JS中BOM和DOM常用的事件

    总结:window对象 ● window.innerHeight - 浏览器窗口的内部高度 ● window.innerWidth - 浏览器窗口的内部宽度 ● window.open() - 打开新 ...

  8. MySql 严格模式相关配置

    目录 MySql 严格模式 MySQL的sql_mode合理设置 sql model 常用来解决下面几类问题 sql_mode常用值 注意 改为严格模式后可能会存在的问题 模式设置和修改(以解决上述问 ...

  9. 几种常见的Preference总结

    DialogPreference共性 DialogPreference通用属性 说明 android:dialogIco 对话框的icon android:dialogLayout dialog的co ...

  10. RabbitMQ-python应用

    介绍 官方文档:https://www.rabbitmq.com/tutorials/tutorial-one-python.html RabbitMQ是一个基于AMQP协议的消息代理.它的工作就是接 ...