linux安装nginx注意事项
来源:互联网 发布:福建广电网络爱家app 编辑:程序博客网 时间:2024/06/06 19:54
一. Nginx是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP服务器,期初开发的目的就是为了代理电子邮件服务器室友:Igor Sysoev开发,源代码符合BSD开源。其特点就是占用内存少并发能力强,在天朝使用Nginx的大型网站已经有很多:百度、淘宝、腾讯等等...。
Nginx作为Http服务器,有以下几项基本特征:
1 处理静态文件,索引文件以及自动索引,打开文件描述符缓冲。
2 无缓存的反向代理加速,简单的负载均衡和容错
3 模块化的结构,包括gzipping,byte ranges,chunked responses以及SSI-filter等filter,如果由FastCGI或其它代理服务器处理蛋液中存在的多个SSI,则这项处理可以并行运行,而不需要相互等待。
4 支持SSL和TLSSNI。
二、nginx的安装
1、安装nginx的依赖库:
r如果安装中出现You need Perl 5.
tar -zxvf perl-*.tar.gz
./Configure -des -Dprefix=/usr/local/perl -Dusethreads -Uversiononly&make&make install
Yum installs openssl-devel
①如果linux没有c++编译,yum install gcc-c++
②安装openssl-fips_*.tar.gz 解压后,
cd openssl-fips
./config&make&make install
③gzip模块需要zlib库、
cd zilb*/
./configure&make&make install
④rewrite模块需要pcre库
cd pcre/
./configure&make&make install
⑤安装nginx
解压后cd nginx/
./configure --with-http_stub_status_module --with_http_ssl_module --with pcre&make&make install
三、nginx配置
生成sslKey
$ cd /usr/local/nginx/conf
$ openssl genrsa -des3 -out server.key 1024
$ openssl req -new -key server.key -out server.csr
$ cp server.key server.key.org
$ openssl rsa -in server.key.org -out server.key
$ openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
四、编辑 nginx.conf
server {
server_name YOUR_DOMAINNAME_HERE;
listen 443;
ssl on;
#certfile
ssl_certificate /usr/local/nginx/conf/server.crt;
#keyfile
ssl_certificate_key /usr/local/nginx/conf/server.key;
location / {
#to host name
proxy_pass http://127.0.0.1:8080;
root html;
index index.html index.htm;
}
}
至此Nginx的安装完成!
检测是否安装成功
[root@localhost nginx-1.2.6]# cd /usr/local/nginx/sbin
[root@localhost sbin]# ./nginx -t
如图所示,表示Nginx安装成功.
启动nginx
[root@localhost sbin]# ./nginx
查看端口
[root@localhost sbin]# netstat -ntlp
最后就可以打开http://127.0.0.1/就能看见nginx的欢迎界面了
启动nginx
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
启动出错:/usr/local/nginx/sbin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
解决办法:ldd /usr/local/nginx/sbin/nginx ===== 查看链接库是否正常
Linux-vdso.so.1 = (0x00007fff1e3ff000)
libpthread.so.0 = /lib64/libpthread.so.0 (0x0000003ea5800000)
libcrypt.so.1 = /lib64/libcrypt.so.1 (0x0000003eb0400000)
libpcre.so.1 = not found
libz.so.1 = /lib64/libz.so.1 (0x0000003ea6800000)
libc.so.6 = /lib64/libc.so.6 (0x0000003ea5000000)
/lib64/ld-linux-x86-64.so.2 (0x0000003ea4c00000)
libfreebl3.so = /lib64/libfreebl3.so (0x0000003eb1000000)
libdl.so.2 = /lib64/libdl.so.2 (0x0000003ea5400000)
9、ln -s libpcre.so.0.0.1 libpcre.so.1
10、再次启动nginx
./usr/local/nginx/sbin/nginx
11、ps -ef | grep nginx
查看nginx是否启动成功
12、设置ngin自启动
chkconfig --add nginx
chkconfig nginx on
- linux安装nginx注意事项
- Linux(Centos)之安装Nginx及注意事项
- Linux(Centos)之安装Nginx及注意事项
- Linux(Centos)之安装Nginx及注意事项
- Linux(Centos)之安装Nginx及注意事项
- 【Linux】Centos之安装Nginx及注意事项
- 【Linux】Centos之安装Nginx及注意事项
- 【Linux】Centos之安装Nginx及注意事项
- 【Linux】Centos之安装Nginx及注意事项
- 【Linux】Centos之安装Nginx及注意事项
- 【Linux】Centos之安装Nginx及注意事项
- Linux下Nginx安装与配置注意事项
- Linux(Centos)之安装Nginx及注意事项
- Linux(Centos)之安装Nginx及注意事项
- Linux(Centos)之安装Nginx及注意事项
- Linux(Centos)之安装Nginx及注意事项
- Linux(Centos)之安装Nginx及注意事项
- Nginx--Linux(Centos)之安装Nginx及注意事项
- Spring In Action<五>
- iOS开发 封装导航栏
- android设备信息
- MySql接口函数
- datepicker只显示年月
- linux安装nginx注意事项
- Air.Bandits.v1.0-HERiTAGE\
- 《技术大牛养成指南》
- [RK3288][Android6.0] Display中的Composition机制
- cuda遇到的问题:
- python3调用Google翻译
- Php开发ZendStudio常用快捷键大全
- 中断、异常、trap 的区别
- centos7安装notepadqq