如何重新生成此nginx配置
location / {
try_files /public/$uri @app;
}
location @app {
fastcgi_pass php5-fpm;
}
}
到Apache配置?
发布于 2017-09-16 02:32:15
这实际上只做了两件事。
因此,在Apache中,我们需要首先进行测试
RewriteCond %{DOCUMENT_ROOT}/public/%{REQUEST_URI} -f
RewriteRule (.*) /public/$1 [L]
RewriteCond在以下规则中加入了一个条件,-f表示该文件存在。因此,我们知道该文件存在于public子目录中,因此应用重写请求到public子目录的规则。L标志表示Apache将认为这是最后一个重写规则,不会处理任何其他重写规则。
现在是第二部分。
RewriteRule . "-" [H=application/x-httpd-php]
当然,这假设所有适当的apache模块都已安装并处于活动状态,特别是mod_rewrite,并且已经调用了RewriteEngine on
。值得一提的是,在nginx和apache中,必须设置更多选项才能正常工作。
更多文档在这里:http://httpd.apache.org/docs/current/mod/mod_rewrite.html
发布于 2017-09-12 03:11:17
这是你可以使用的东西(我想需要一些调整):
Alias /public /xxxxx/public
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/public/
RewriteCond /xxxxx/public/%{REQUEST_URI} !-f
RewriteCond /xxxxx/public/%{REQUEST_URI} !-d
RewriteRule . "-" [H=application/x-httpd-php]
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule (.) /public/$1 [L,QSA]
应用程序是php处理程序,它可以在您的设置中有所不同(fcgid- application/x-httpd-php
/application/x-httpd-php
/php ...)检查由php设置定义的处理程序。
https://stackoverflow.com/questions/44296128
复制相似问题