`
ribishuangba
  • 浏览: 291037 次
文章分类
社区版块
存档分类
最新评论

CppCMS和Nginx协同工作

 
阅读更多

为什么需要Nginx

CppCMS自己已经支持Http访问,为什么还需要Nginx.一些原因是我们需要动态负载平衡,还有原因是安全问题。下面的文字来自于CppCMS站点。
CppCMS provides basic implementation of HTTP protocol and thus it can run behind reverse HTTP Proxy. But this option is not recommended for use in production environment unless HTTP protocol is fully sanitized by the proxy itself, otherwise you may expose yourself to various security issues.

Nginx开启FastCGI

在nginx.conf文件的server一节添加如下配置,请注意^/hello(.*)$代表用CppCMS构建的Web站点的URI的上下文路径。而fastcgi_pass 192.168.30.17:8081 则是指Nginx要和位于30.17的CppCMS站点通过FastCGI协议通信。这里其实可以指定多个。



CppCMS配置

现在来配置30.17上的CppCMS服务。主要是config.js文件的内容:
"service" : {
"api" : "fastcgi",
"ip" : "192.168.30.17",
"port" : 8081
}

测试

现在启动CppCMS服务和Nginx服务。然后测试通过。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics