Linux 下nginx安装
1、安装pcre
从pcre的官网下载tar.gz
tar -zxvf pcre-8.38.tar.gz
cd pcre-8.38
./configure
make
make install
2、安装zlib
从zlib的官网下载tar.gz包
tar -xvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure
make
make install
3、安装nginx
tar -zxvf nginx-1.9.15.tar.gz
cd nginx-1.9.15
./configure
make
make install
4.启动 nginx
进入 /usr/local/nginx/sbin
./nginx
5.启动报错解决办法
报错信息
error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
解决方法:
ln -s /usr/local/lib/libpcre.so.1/lib64
6.停止
进入 /usr/local/nginx/sbin
./nginx -s stop
nginx 配置负载均衡,通过测试配置文件是ok的。
nginx.conf 如下
#user nobody;
#工作的子进程数量(通常等于CPU数量或者2倍于CPU)
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;
server_names_hash_bucket_size 256;
client_header_buffer_size 256k;
large_client_header_buffers 4 256k;
keepalive_timeout 120;
client_max_body_size 50m;
client_body_buffer_size 256k;
proxy_connect_timeout 600;
proxy_read_timeout 600;
proxy_send_timeout 600;
proxy_buffer_size 16k;
proxy_buffers 4 64k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 128k;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
sendfile on;
tcp_nodelay on;
upstream mktinfo_pool{
server 120.77.86.13:9001;
server 120.77.145.156:9001;
}
server {
listen 8080;
server_name 127.0.0.1;
location / {
proxy_pass http://mktinfo_pool;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
access_log ./logs/access.log;
}
# 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;
# }
#}
}
相关推荐
linux下安装nginx被配置sticky模块的相关软件包,包含nginx.conf的简单实例
NULL 博文链接:https://aperise.iteye.com/blog/2223373
NULL 博文链接:https://andyaqu.iteye.com/blog/2030047
linux下Nginx+tomcat整合的安装与配置
linux下安装Nginx所需依赖包合集
linux安装nginx并支持ssl,使得服务器支持证书签名,提升应用的安全性
1)资源:linux下nginx离线安装包及相关依赖包; 2)教程:https://blog.csdn.net/hualinger/article/details/125298009?spm=1001.2014.3001.5502
linux下nginx离线安装包--附带所有依赖环境和安装教程,当linux无外网情况下,可通过此安装版安装,一次性解决所有依赖,按照压缩包内教程,即可从头到尾安装完毕
Linux离线安装nginx安装包,附带安装教程,可以及时更新最新安装路径
一、nginx介绍及功能讲解 二、nginx的安装 三、nginx配置相关指令 四、nginx的实例应用(项目部署)
Nginx 1.22.0 Linux 版本,解压安装。 Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,在BSD-like 协议下发行。其特点是占有内存少,并发能力强,事实上nginx的并发能力在同类型...
本篇文章主要介绍了Linux下Nginx安装的方法(pcre和openssl),小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
Linux系统下无网络环境安装nginx,直接解压即可使用,不用编译,不依赖其他 1.启动nginx,进入nginx安装目录执行:./sbin/nginx -c ./conf/nginx.conf 2.重启新加载nginx配置文件,进入nginx安装目录执行:./sbin/...
此压缩包中存放着linux安装nginx所需要的安装包,按照链接的文档按顺序进行安装
Linux离线安装Nginx资源包
nginx在linux系统下的安装包,一共有四个:Nginx-1.12.2.tar.gz,zlib-1.2.11.tar.gz,pcre-8.41.tar.gz,openssl-fips-2.0.16.tar.gz没有资源分的也可以到我的另一篇文章中根据链接下载...
在linux系统下的nginx 安装依赖包和安装操作教程,包括nginx-1.11.7.tar.gz,openssl-1.1.0c.tar.gz,pcre-8.39.tar.gz和zlib-1.2.8.tar.gz
linux系统nginx一键自动离线安装包,含安装脚本。内含zlib、pcre、openssl、nginx等安装包
linux nginx依赖包
gcc、gcc-c++、libstdc++、pcre、pcre-devel、zlib、zlib-devel