Answer the question
In order to leave comments, you need to log in
Nginx how to configure host to process object files via FastCGI?
I need to run a c++ page for the first time on my local computer.
I read different manuals and nothing happened to me.
for example, such a manual with host settings (but for apache, not nginx) and code and even an example demonstration: www.tutorialspoint.com/cplusplus/cpp_web_programmi...
and here there are settings for
nginx habrahabr.ru/post/154187
regular php files and static pages.
that is, I wrote in /etc/hosts
127.0.0.1 f.ci
this is my site called f.ci
I installed nginx fcgi and other packages...
configured the server as described in the ubuntu manual help.ubuntu.ru/wiki/nginx-phpfpm
and added host:
Listing host file /etc/nginx/sites-available/f.ci
server
{
listen 80;
server_name f.ci www.f.ci *.f.ci;
root /var/www/f.ci/public;
index index.php index.html index.htm;
location /
{
try_files $uri $uri/ =404;
}
location ~ \.php$
{
try_files $uri =404;
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
}
}
листинг исходного кода программы cgi.cgi
#include <iostream>
using namespace std;
int main ()
{
cout << "Content-type:text/html\r\n\r\n";
cout << "<html>\n";
cout << "<head>\n";
cout << "<title>Hello World - First CGI Program</title>\n";
cout << "</head>\n";
cout << "<body>\n";
cout << "<h2>Hello World! This is my first CGI program</h2>\n";
cout << "</body>\n";
cout << "</html>\n";
return 0;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question