nginx: 功能:web服务,web代理 ,smtp反向代理- yum install gcc openssl-devel pcre-devel zlib-devel
-
groupadd nginx
-
useradd –g nginx –s /bin/false –M nginx
- # tar xvf nginx-1.1.3.tar.gz
-
#cd nginx-1.1.3.tar.gz
-
# ./configure \
-
--prefix=/usr \
-
--sbin-path=/usr/sbin/nginx \
-
--conf-path=/etc/nginx/nginx.conf \
-
--error-log-path=/var/log/nginx/error.log \
-
--http-log-path=/var/log/nginx/access.log \
-
--pid-path=/var/run/nginx/nginx.pid \
-
--lock-path=/var/lock/nginx.lock \
-
--user=nginx \
-
--group=nginx \
-
--with-http_ssl_module \
-
--with-http_flv_module \
-
--with-http_stub_status_module \
-
--with-http_gzip_static_module \
-
--http-client-body-temp-path=/var/tmp/nginx/client/ \
-
--http-proxy-temp-path=/var/tmp/nginx/proxy/ \
-
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \
-
--with-pcre 支持Perl
若要其他的可以用./configure –help安装好后启动nginx,由于启动时没有脚本自己写放在/etc/init.d/:保存设置执行权限
- #chown +x /etc/init.d/ngixd
介绍一些其他的upstream反向代理
- upstream name {
-
server IP:80 weight=3;
-
server IP:80 ;
-
}
location 某个网页位置中的某个文件的访问权限
location [ =|~|~*|^~|@]
=表示精确匹配
不带任何符号模糊匹配
~ 区分大小写的正则表达式
~* 不区分大小写正则表达式
^~ 禁用正则表达式
对于特定子目录的优先级高
What is FastCGIFastCGI
is a high-speed and scalable interface for communicating with the web server scripting language. FastCGI is supported by many scripting languages, including php, if it is compiled with the option - --enable-fastcgi. It is supported by most popular web servers, including Apache (mod_fastcgi and mod_fcgid), Zeus, nginx and lighttpd. The main advantage of FastCGI is isolating the dynamic language from the web server. The technology, among other things, allows you to run a web server and dynamic language for the different hosts, which improves scalability and also aids security without a significant loss of productivity.PHP-FPM works on with any web server that supports FastCGI.
启动服务:service ngixd start 其中ngixd是编写的脚步的名字
- [root@squid2 nginx]# netstat -ntulp |grep nginx
- tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 12713/nginx.conf
压力测试
阅读(1016) | 评论(0) | 转发(0) |