问题
I have set up Symfony in bitnami on Amazon EC2. Now I want to access web/config.php
, but was told the file can only be run via localhost.
And I also tried to log on remote desktop of EC2, but failed. So now how can I ensure symfony is all good on server?
回答1:
Open config.php
and edit following code
if (!in_array(@$_SERVER['REMOTE_ADDR'], array(
'127.0.0.1',
'::1',
))) {
header('HTTP/1.0 403 Forbidden');
exit('This script is only accessible from localhost.');
}
You can either add the IP Address oft the remote server or just comment out this piece of code. Consider the last advice is not recommended for security reasons.
回答2:
First use htpasswd to protect your production site. Edit the file config.php and remove.
来源:https://stackoverflow.com/questions/12870243/how-do-i-access-to-symfony-config-php-remotely