为cPanel主机添加nginx服务器软件,让nginx跑前端处理静态文件,两者相比较来说,加装nginx后的资源消耗比单纯跑apache 少很多.最近对nginx自动安装脚本进行很多修改,我仔细的测试了几次.觉得可以应用于生产环境,就在自己的机器上安装了.所以这篇就详细为大家说明是 怎样做到的.
这里引用cPanel Forums上的帖子.作者blargman写了一个专门为 cPanel打造的nginx自动安装脚本.
Evidently I don't know hot to post in the right forum.
This is an automated nginx installer for cpanel. Integrates so that domain adding/removal is all done automatically.
Some people had asked for cpanel support. In lieu of that, this does pretty much everything I can think of that they would do. It creates a vhost for each domain/addon/subdomain and serves up static content.Let me know if you have any thoughts/questions or better yet suggestions.
http://blargman.com/public.tar
以上是作者原文,原文地址:点 击这里.安装方法很简单(建议做好备份),如下:
cd /usr/local/src
wget http://blargman.com/public.tar
tar xf public.tar
cd publicnginx
./nginxinstaller install
安装好之后,重启nginx,执行命令:/etc/init.d/nginx restart.Nginx的配 置文件均在/etc/nginx当中,各用户绑定的域名(附加域,子域等)均在/etc/nginx/vhosts
卸载:
以上下载步骤不变.将最后一步./nginxinstaller install改为./nginxinstaller uninstall执行即可.
--------------------------------------------------------------------------------------------------
移步:iCodex
