ruby-on-rails - 将 ngnix rails conf 转换为 apache
问题描述
我正在尝试在生产服务器中设置 apache。我的 nginx 配置如下所示。
upstream puma {
server unix:///var/www/rails/shared/tmp/sockets/puma.sock;
}
server {
listen 80 default_server deferred;
# server_name example.com;
root /var/www/rails/current/public;
access_log /var/www/rails/current/log/nginx.access.log;
error_log /var/www/rails/current/log/nginx.error.log info;
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
try_files $uri @puma;
location @puma {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://puma;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 10M;
keepalive_timeout 10;
}
但我找不到如何在 httpd 配置中指定套接字。请帮忙。
解决方案
要设置 Apache 服务器侦听的端口,请使用该Listen
指令。
这是它在默认httpd.conf
文件中所说的内容(在/etc/apache2/
我正在使用的 apache2 安装中找到 - 尽管不同的安装/系统将配置目录放在其他位置):
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
#Listen 66.18.208.111:80
#Listen 66.18.208.112:80
Listen 80
如果您使用命名虚拟主机(一台服务器上的多个网站),您将希望在Apache 2.2 vhosts 文档NameVirtualHost
中查看和VirtualHost
指令的说明
推荐阅读
- javascript - 如何停止循环文本动画
- javascript - Typescript - 键入一个接受数组的函数,更改其属性之一,但仍返回相同的类型化数组
- c++ - 如何进行无分支数字循环?
- c++ - QGridLayout 小部件设置相等大小
- sql - 如果 count(column) 然后在 Oracle 中选择
- c# - 在 Cefsharp.WPF 中,我应该如何对“fi-FI”(芬兰语)语言进行拼写检查?
- python - 我在 Pygame 中收到一个关于字体的表面错误。我该如何解决?
- str-replace - 使用 str_replace 函数回显错误数据
- javascript - 获取“仅对页面组件执行导出的查询”。在 Gatsby 中尝试生成页面时
- flutter - 使用 Flutter 和 Dart 实现多个过滤器