Linux-rhel6.4部署nginx
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux-rhel6.4部署nginx相关的知识,希望对你有一定的参考价值。
检查安装
[[email protected] ~]# rpm -qa pcre* pcre-devel-7.8-6.el6.x86_64 pcre-7.8-6.el6.x86_64 [[email protected] ~]# rpm -qa openssl* openssl-1.0.0-27.el6.x86_64
安装nginx
包下载地址:http://nginx.org/en/download.html
[[email protected] ~]# tar -zxvf nginx-1.10.3.tar.gz [[email protected] ~]# cd ngunx-1.10.3 [[email protected] ~]# ./configure ./configure: error: the HTTP rewrite module requires the PCRE library.
报错,原因:没有安装pcre-devel
解决,挂载系统盘,找到rpm包安装:
[[email protected] Packages]# ls pcre* pcre-7.8-6.el6.i686.rpm pcre-7.8-6.el6.x86_64.rpm pcre-devel-7.8-6.el6.i686.rpm pcre-devel-7.8-6.el6.x86_64.rpm [[email protected] Packages]# rpm -ivh pcre-devel-7.8-6.el6.x86_64.rpm warning: pcre-devel-7.8-6.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY Preparing... ########################################### [100%] 1:pcre-devel ########################################### [100%]
重新安装成功:
[[email protected] nginx-1.10.3]# ./configure checking for OS + Linux 2.6.32-358.el6.x86_64 x86_64 checking for C compiler ... found + using GNU C compiler + gcc version: 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) checking for gcc -pipe switch ... found ...... nginx http client request body temporary files: "client_body_temp" nginx http proxy temporary files: "proxy_temp" nginx http fastcgi temporary files: "fastcgi_temp" nginx http uwsgi temporary files: "uwsgi_temp" nginx http scgi temporary files: "scgi_temp" [[email protected] nginx-1.10.3]# make [[email protected] nginx-1.10.3]# make install
主页测试:
[[email protected] ~]# cd /usr/local/nginx/html [[email protected] html]# cat index.html
<!DOCTYPE html> <html> <head> <title>Welcome to nginx!</title> <style> body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; } </style> </head> <body> <h1>Welcome to nginx!</h1> <p>If you see this page, the nginx web server is successfully installed and working. Further configuration is required.</p> <p>For online documentation and support please refer to <a href="http://nginx.org/">nginx.org</a>.<br/> Commercial support is available at <a href="http://nginx.com/">nginx.com</a>.</p> <p><em>Thank you for using nginx.</em></p> </body> </html>
出错,没有开启服务:
[[email protected] html]# curl http://localhost curl: (7) couldn‘t connect to host
开启服务测试成功:
[[email protected] ~]# cd /usr/local/nginx/sbin [[email protected] sbin]# curl http://localhost <!DOCTYPE html> <html> <head> <title>Welcome to nginx!</title> <style> body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; } </style> </head> <body> <h1>Welcome to nginx!</h1> <p>If you see this page, the nginx web server is successfully installed and working. Further configuration is required.</p> <p>For online documentation and support please refer to <a href="http://nginx.org/">nginx.org</a>.<br/> Commercial support is available at <a href="http://nginx.com/">nginx.com</a>.</p> <p><em>Thank you for using nginx.</em></p> </body> </html>
本文出自 “谢育政” 博客,请务必保留此出处http://kurol.blog.51cto.com/11433546/1927570
以上是关于Linux-rhel6.4部署nginx的主要内容,如果未能解决你的问题,请参考以下文章
Linux-rhel6.4 编译安装PHP,Nginx与php连接
nginx.conf 忽略了 nginx-ingress 配置映射片段