【必须把所有下载的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. 数据建模工具------EZMNL

    表结构设计器(EZDML) 表结构设计器EZDML1.5新版本发布,比以前介绍的1.2版本改进了很多,因此重新写了个介绍. 表结构设计,即所谓的数据建模,目前大家常用的同类著名工具有PowerDesi ...

  2. 【图解】cpu,内存,硬盘,指令的关系

    1 程序员用高级语言编写程序. 2 经过编译 链接等形成机器语言的EXE文件. 3 EXE文件保持在磁盘的某个或多个扇区内 4 程序运行是在内存中生成EXE的副本 5 将指令读入cpu的寄存器 6 由 ...

  3. OC与swift混编 #import "项目名-Swift.h"失效问题

    由于项目多个环境部署,每次改配置比较麻烦,所以线上环境一个TARGETS,内部环境一个TARGETS, 都知道oc和swift混编的时候,会生成一个'项目名-Swift.h'文件,这个文件是隐式的,需 ...

  4. PowerDesigner 连接数据库,更新数据库;

    首先:以管理员身份运行Powerdesigner 一.连接服务器的某个数据库: 点击新建数据源图标 选择数据源类型:用户数据源:这里说是只用于当前机器,实际局域网里的都可以. Successfully ...

  5. 【Linux下Hadoop-eclipse-plus-3.2.0】编译Hadoop连接eclipse的插件遇见的一系列错误,崩溃的操作

    2019-09-02 23:35:22 前言:首先,我想吐槽下自己,居然花费了4到5个夜晚和中午的时间来做这件事情,直到刚才才顺利解决,我也挺佩服自己的! 我在这个过程中参考其他人的博客,非常感谢他们 ...

  6. 打造kubernetes 高可用集群(nginx+keepalived)

    一.添加master 部署高可用k8s架构 1.拷贝/opt/kubernetes目录到新的master上(注意如果新机上部署了etcd要排除掉) scp -r /opt/kubernetes/ ro ...

  7. CF: Long Number

                                                    题目链接 #include<iostream> #include<string> ...

  8. python---Numpy模块中创建数组的常用方式代码示例

    要机器学习,这方面内容不可少. import numpy as np import time # 对比标准python实现和numpy实现的性能差异 def sum_trad(): start = t ...

  9. JS之try..catch...

    try 测试代码块的错误. catch 语句处理错误. throw 创建并跑出错误. try { //在这里运行代码 抛出错误 }catch(err){ //在这里处理错误 } 实例: <p&g ...

  10. BZOJ4659: Lcm

    Description 给出A,B,考虑所有满足l<=a<=A,l<=b<=B,且不存在n>1使得n^2同时整除a和b的有序数 对(a,b),求其lcm(a,b)之和.答 ...