Apache and Cutelyst
阿帕奇和Cutelyst
Buschmann edited this page on Jul 12, 2017 · 2 revisions
Buschmann于2017年7月12日编辑本页
Beside running Cutelyst apps with cutelyst-wsgi as standalone web server you can run Cutelyst applications behind an Apache web server using Apache's mod_proxy and mod_proxy_http or mod_proxy_fcgi.
除了使用Cutelyst wsgi作为独立web服务器运行Cutelyst应用程序外,还可以在Apache web服务器后面使用Apache的mod_proxy和mod_proxy_http或mod_proxy_fcgi运行Cutelyst应用程序。
We will make the following assumptions for paths and users/groups. These might be different on your distribution/operating system:
我们将对路径和用户/组进行以下假设。这些在您的发行版/操作系统上可能有所不同:
- Apache user: wwwrun
- Apache group: www
- Cutelyst FastCGI socket path: /run/mycutelystapp.sock
- HTTP/1.1 TCP socket: 127.0.0.1:3000
- Cutelyst app file path: /usr/lib64/cutelyst-apps/mycutelystapp.so
- Cutelyst app user: myuser
- Cutelyst app group: mygroup
- Cutelyst app static files path: /usr/share/mycutelystapp/templates/default/static
Cutelyst, FastCGI and mod_proxy_fcgi
Up to Cutelyst 1.6.0 there are some issues in Cutelyst (#37) and Qt (#38) that prevent the usage of Cutelyst together with Apache via FastCGI. So you should use Cutelyst 1.7.0 or newer.
在Cutelyst 1.6.0之前,Cutelyst(#37)和Qt(#38)中存在一些问题,阻止通过FastCGI与Apache一起使用Cutelyst。所以你应该使用Cutelyst 1.7.0或更新版本。
For this approach you need to have mod_proxy and mod_proxy_fcgi enabled in your Apache web server.
对于这种方法,您需要在Apache web服务器中启用mod_proxy和mod_proxy_fcgi。
a2enmod proxy
a2enmod proxy_fcgi
Apache virtual host configuration with unix domain socket
使用unix域套接字配置Apache虚拟主机
This needs Apach 2.4.9 or newer.
这需要Apach2.4.9或更新版本。
<VirtualHost *:80>
ServerName example.com
ProxyPass / unix:/run/mycutelystapp.sock|fcgi://mycutelystapp/
# optionally you can serve your static files directly with Apache instead of Cutelyst
# for this you need to have mod_alias to be enabled
Alias /static /usr/share/mycutelystapp/templates/default/static
<Location /static>
ProxyPass !
Require all granted
</Location>
</VirtualHost>
cutelyst-wsgi command line parameters for this:
cutelyst wsgi命令行参数:
cutelyst-wsgi -a /usr/lib64/cutelyst-apps/mycutelystapp.so -uid myuser --gid mygroup --fastcgi-socket /run/mycutelystap