![](/img/trans.png)
[英]Plesk 11.5 php-fpm.sock failed - resource temporarily unavailable & 502 Bad Gateway NGINX errors
[英]Configuring Nginx for Phalcon on a Plesk 11.5 server
我一直在本地開發環境(Vagrant + Virtualbox)中與Phalcon一起進行一個項目。 它工作得很好,並且我的開發時間確實減少了。
現在,我想在Plesk 11.5 nginx環境中將該項目聯機,然后遇到在Plesk中為Phalcon配置Nginx的問題。 我對Nginx也很陌生。
我有以下Nginx配置:
server {
listen 80;
server_name localhost.dev;
index index.php index.html index.htm;
set $root_path '/var/www/httpdocs';
root $root_path;
try_files $uri $uri/ @rewrite;
location @rewrite {
rewrite ^/(.*)$ /index.php?_url=/$1;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
root $root_path;
}
location ~ /\.ht {
deny all;
}
}
我刪除了“服務器{}”,因為在Plesk nginx配置中不允許使用這些服務器。 但是,它根本不起作用。 該應用程序的主頁顯示得很完美,因此Phalcon運行得很好,但是路由卻不起作用:/ search僅給出一個404,在此配置下,它在我的本地環境中可以正常工作。
我應該在Plesk中進行哪些更改才能使其正常工作?
謝謝您的寶貴時間!
首先檢查域上的PHP是通過PHP-FPM還是Apache處理的。
如果您使用nginx就像apache的反向代理和apache處理的PHP一樣,則只需將Phalcon引導程序index.php和.htaccess放到/var/www/vhosts/domain.tld/httpdocs中,並將所有其他應用程序文件放到/ var中/www/vhosts/domain.tld(我已經在這種配置下成功運行了Phalcon教程)
對於PHP-FPM,最簡單的方法是定義自定義虛擬主機模板
mkdir -p /usr/local/psa/admin/conf/templates/custom/domain
cp /usr/local/psa/admin/conf/templates/default/domain/nginxDomainVirtualHost.php /usr/local/psa/admin/conf/templates/custom/domain/
在/usr/local/psa/admin/conf/templates/custom/domain/nginxDomainVirtualHost.php中,為您的域名設置條件只是回顯整個完整的配置,例如:
<?php if $VAR->domain->asciiName == 'your-domain.tld' ?>
plain text of your full nginx config here
<?php else: ?>
plesk default instruction for all other domains
<?php endif ?>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.