'How to run different web pages in C++ and FCGI on Nginx?
I follow the following tutorial to create a web page with C++ and FCGI running on Nginx.
http://chriswu.me/blog/writing-hello-world-in-fcgi-with-c-plus-plus/
After I run the following command lines, everything works perfect!
g++ main_v1.cpp -lfcgi++ -lfcgi -o hello_world
spawn-fcgi -p 8000 -n hello_world
But this is for one page. If I want to run 2 or 3 pages such as about or contact. How can I do that?
Solution 1:[1]
There is 2 ways of doing it:
(best way) you re-write your default fastcgi application and add handler for every page/request you need
(ugly way) you write 2 additional fastcgi applicaiton and launch them on different ports, then change your
nginx.confto serve specific requests like/aboutor/contactwith different fastcgi applications with proxy_pass directive
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | user973254 |
