[Cppcms-users] Very strong problems when running the CppCms project
Brought to you by:
artyom-beilis
From: Юрий Ч. <sha...@ma...> - 2017-11-26 14:02:04
|
Good evening, dear friends! I really love the CppCms framework, because it gives controllability, power and speed. I have an error in the project: "No configuration defined" I can not yet run the minimal project on CppCms. Can you help? I'm using Nginx 1.10.3. I configured the nginx.conf configuration file like this: user yurkosan; worker_processes 12; pid /run/nginx.pid; include /etc/nginx/modules-enabled/*.conf; events { worker_connections 768; } http { sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE ssl_prefer_server_ciphers on; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log notice; gzip on; gzip_disable "msie6"; include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; server { # Нужно вручную создать переменую PATH_INFO # используя перезапись URL set $path_info ""; if ( $fastcgi_script_name ~ ^/hello(.*)$ ) { set $path_info $1; } # Указываем URL для совпадения location ~ ^/hello.*$ { # Сокет для обмена данными fastcgi_pass unix:/tmp/hello-fcgi-socket; # Все поддерживаемые переменные CGI fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param SCRIPT_NAME /hello; fastcgi_param PATH_INFO $path_info; fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param GATEWAY_INTERFACE CGI/1.1; fastcgi_param SERVER_SOFTWARE nginx; fastcgi_param REMOTE_ADDR $remote_addr; fastcgi_param REMOTE_PORT $remote_port; fastcgi_param SERVER_ADDR $server_addr; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_NAME $server_name; } } } I use this project configuration file (config.json): { "service" : { "api" : "fastcgi", "socket" : "/tmp/hello-fcgi-socket" } } I use the environment of Qt Creator 4.5.0 (Qt 5.9.2). I'm using the following project file (kinomusorka_ru.pro): LIBS += -L/usr/local/lib/ -lbooster -lcppcms INCLUDEPATH += /usr/local/include DEPENDPATH += /usr/local/include TEMPLATE = app CONFIG += console c++14 CONFIG -= app_bundle CONFIG -= qt SOURCES += main.cpp I use the following source code (main.cpp): #include <cppcms/application.h> #include <cppcms/applications_pool.h> #include <cppcms/service.h> #include <cppcms/http_response.h> #include <iostream> class my_hello_world : public cppcms::application { public: my_hello_world(cppcms::service &srv) : cppcms::application(srv) { } virtual void main(std::string url); }; void my_hello_world::main(std::string /*url*/) { response().out()<< "<html>\n" "<body>\n" " <h1>Hello World</h1>\n" "</body>\n" "</html>\n"; } int main(int argc,char ** argv) { try { cppcms::service srv(argc,argv); srv.applications_pool().mount(cppcms::applications_factory<my_hello_world>()); srv.run(); } catch(std::exception const &e) { std::cerr<<e.what()<<std::endl; } } // vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 The project configuration file is in the folder /home/yurkosan/www/domains/kinomusorka.ru/debug. In the same folder is the assembly of binary files. As a result, I get an error "No configuration defined". The project does not start. Tell me, what do I need to do to run the minimal project on the framework? Can you give a ready-made example for a nginx server and Qt Creator? With deep respect. Yuri. Novosibirsk. |