首页 > 代码库 > nginx安装

nginx安装

可以参考http://nginx.org/en/linux_packages.html#stable

下面内容是摘抄自上链接的文章

Pre-Built Packages for Stable version

 

Alternatively, a repository configuration can be added manually without installing the nginx-release package. Create the file named /etc/yum.repos.d/nginx.repo with the following contents:

[nginx]name=nginx repobaseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/gpgcheck=0enabled=1

Replace “OS” with “rhel” or “centos”, depending on the distribution used, and “OSRELEASE” with “5” or “6”, for 5.x or 6.x versions, respectively.

then run the following:

yum install nginx
2 、nginx安装目录说明
/usr/sbin/nginx nginx可执行文件
/etc/nginx/ 下面有配置文件nginx.conf,在nginx.conf又include了自定义的配置文件(在同目录的子文件夹conf.d里),如默认的为default.conf,可以修改default.conf或建立自己的conf文件。
/usr/share/nginx/html/ 网站源码所在文件夹
3、启动、停止或重启nginx
sudo /etc/init.d/nginx start/stop/restart