【发布时间】:2016-01-12 21:32:15
【问题描述】:
我正在尝试在 Linux 服务器 CentOS 7 操作系统上设置 CakePHP 3。我已经使用 composer 创建了一个项目,并且所有内容都以适当的权限正确安装。在我的虚拟主机文件中,我根据official document配置了配置文件
server {
listen 80;
server_name remote.inodd.com;
## redirect http to https ##
rewrite 301 https://$server_name$request_uri permanent;
#rewrite 301 https://$server_name$request_uri permanent;
}
server {
# listen 80;
listen 443 ssl;
server_name remote.inodd.com;
ssl_certificate /home/vhost/www/domain/ssl/self-ssl.crt;
ssl_certificate_key /home/vhost/www/domain/ssl/self-ssl.key;
# note that these lines are originally from the "location /" block
root /home/vhost/www/domain/public_html;
index index.php;
access_log /home/vhost/www/domain/logs/access_log;
error_log /home/vhost/www/domain/logs/error_log;
location / {
#try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php?url=$request_uri;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
所以当我浏览 url https://remote.inodd.com/development/ 时,我会得到显示 cakephp 配置状态的默认登录页面。一切都检查正常,甚至数据库连接。但我收到以下警告,即重写配置不正确。
您的服务器上未正确配置 URL 重写。
1) 帮我配置一下
2) 我不/不能使用 URL 重写
不确定我在这里还缺少什么,因为我能够设置非 cakephp 网站并且它们工作正常。
【问题讨论】:
标签: cakephp nginx cakephp-3.0