【发布时间】:2018-05-28 09:25:18
【问题描述】:
我的网站在 apache 服务器上完美运行。现在我正在尝试在 nginx 服务器上实现,我遇到了问题,比如我的 magento 的 phtml 文件执行为 html。我尝试在 nginx 配置文件中添加 "*.phtml" 扩展名,但没有成功。
这里是我的配置文件
cat /etc/nginx/sites-enabled/mydomain.com
server {
listen 80 default_server;
root /usr/share/nginx/mydomain.com/;
index index.php index.phtml index.html index.htm;
server_name domain.com;
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.(php|phtml)$ {
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
include snippets/fastcgi-php.conf;
}
}
请建议我如何在 nginx 中将“.html”文件解决为“.phtml”?
【问题讨论】: