Nginx简介(待编辑)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Nginx简介(待编辑)相关的知识,希望对你有一定的参考价值。
nginx是一款轻量级但高性能的Web服务器及反向代理服务器,也是邮件的代理服务器,越来越多的人开始使用Nginx来替代原本使用的Apache。
Nginx的安装:
1、CentOS&Redhat的yum安装(以CentOS6.x为例):
确认系统信息
[[email protected] ~]# cat /etc/redhat-release CentOS release 6.7 (Final) [[email protected] ~]# uname -r 2.6.32-504.el6.x86_64 [[email protected] ~]# uname -m x86_64
确认是否已经安装
[[email protected] ~]# rpm -aq nginx [[email protected] ~]#
首先建议将yum源修改为阿里云
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
使用yum搜索nginx包
[[email protected] ~]# yum search nginx Loaded plugins: fastestmirror, security Determining fastest mirrors * base: mirrors.aliyun.com * epel: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com base | 3.7 kB 00:00 epel | 4.3 kB 00:00 epel/primary_db | 5.8 MB 00:13 extras | 3.4 kB 00:00 updates | 3.4 kB 00:00 updates/primary_db | 3.9 MB 00:10 ========================================================================= N/S Matched: nginx ========================================================================= collectd-nginx.x86_64 : Nginx plugin for collectd munin-nginx.noarch : Network-wide graphing framework (cgi files for nginx) nginx-filesystem.noarch : The basic directory layout for the Nginx server owncloud-nginx.noarch : Nginx integration for ownCloud nginx.x86_64 : A high performance web server and reverse proxy server Name and summary matches only, use "search all" for everything. [[email protected] ~]#
yum安装nginx
[[email protected] ~]# yum install nginx -y
启动nginx
[[email protected] ~]# /etc/init.d/nginx start Starting nginx: [ OK ]
设置开机自启动nginx
[[email protected] ~]# chkconfig --list nginx nginx 0:off1:off2:off3:off4:off5:off6:off [[email protected] ~]# chkconfig nginx on [[email protected] ~]# chkconfig --list nginx nginx 0:off1:off2:on3:on4:on5:on6:off
2、Ubuntu&Debian的apt安装(以Debian7.x为例):
确认系统信息
[email protected]:~# cat /etc/issue Debian GNU/Linux 7 \n \l [email protected]:~# [email protected]:~# uname -r 3.2.0-4-amd64 [email protected]:~# uname -m x86_64
确认是否已经安装
[email protected]:~# dpkg -s nginx dpkg-query: package ‘nginx‘ is not installed and no information is available Use dpkg --info (= dpkg-deb --info) to examine archive files, and dpkg --contents (= dpkg-deb --contents) to list their contents.
使用apt搜索nginx包
[email protected]:~# apt-cache search nginx collectd-core - statistics collection and monitoring daemon (core system) fcgiwrap - simple server to run CGI applications over FastCGI gitweb - fast, scalable, distributed revision control system (web interface) gunicorn - Event-based HTTP/WSGI server libplack-middleware-file-sass-perl - Sass and SCSS support for all Plack-based PSGI frameworks nginx - small, powerful, scalable web/proxy server nginx-common - small, powerful, scalable web/proxy server - common files nginx-doc - small, powerful, scalable web/proxy server - documentation nginx-extras - nginx web/proxy server (extended version) nginx-extras-dbg - nginx web/proxy server (extended version) - debugging symbols nginx-full - nginx web/proxy server (standard version) nginx-full-dbg - nginx web/proxy server (standard version) - debugging symbols nginx-light - nginx web/proxy server (basic version) nginx-light-dbg - nginx web/proxy server (basic version) - debugging symbols nginx-naxsi - nginx web/proxy server (version with naxsi) nginx-naxsi-dbg - nginx web/proxy server (version with naxsi) - debugging symbols nginx-naxsi-ui - nginx web/proxy server - naxsi configuration front-end rt4-fcgi - External FastCGI support for request-tracker4 ruby-passenger - Rails and Rack support for Apache2 and Nginx stud - scalable TLS unwrapping daemon uwsgi-extra - fast, self-healing application container server (extra files)
通过apt安装nginx
[email protected]:~# yes | apt-get install nginx
再次查看nginx是否已经安装
[email protected]:~# dpkg -s nginx Package: nginx Status: install ok installed Priority: optional Section: httpd Installed-Size: 87 Maintainer: Kartik Mistry <[email protected]> Architecture: all Version: 1.2.1-2.2+wheezy3 Depends: nginx-full | nginx-light Description: small, powerful, scalable web/proxy server Nginx ("engine X") is a high-performance web and reverse proxy server created by Igor Sysoev. It can be used both as a standalone web server and as a proxy to reduce the load on back-end HTTP or mail servers. . This is a dependency package to install either nginx-full (by default) or nginx-light. Homepage: http://nginx.net
本文出自 “菜鸟东” 博客,请务必保留此出处http://radish.blog.51cto.com/5944322/1742733
以上是关于Nginx简介(待编辑)的主要内容,如果未能解决你的问题,请参考以下文章
Nginx——Nginx启动报错Job for nginx.service failed because the control process exited with error code(代码片段