如何在amazon ec2上运行php7 nginx? (弹性IP?)
问题描述:
我已经安装nginx和php7到亚马逊EC2。 它通过本地IP检查它的工作原理。但它不通过弹性IP。 有人可以帮我吗?如何在amazon ec2上运行php7 nginx? (弹性IP?)
server {
listen 80 default_server;
root /var/www/html;
index index.php index.html;
server_name 52.43.19.61;
location/{
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location ~ \.php$ {
try_files $uri = 404;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
答
夫妇的问题:与您的实例
- 您的弹性IP相关的?
- 您的安全组实例允许传入连接?
- 您的实例防火墙允许传入连接吗?
- 您的应用程序侦听
- 您尝试访问哪个端口?
- 您是否已经在安全组上打开该端口?你有一个 应用程序在该端口上侦听吗?
- 另请确保VPC的路由表设置为启用IP地址 以外的VPC(0.0.0.0/0)从子网流向Internet网关。
- 如果我不得不猜测您的安全组设置不正确。如果要从多个IP访问该端口,请确保 将其打开到正确的IP地址或全球(0.0.0.0/0) 。
如果这一切都不是,那么分离并重新分配IP到实例。
谢谢你的所有问题。我不是专业人士来检查这一切。我使用所有标准设置ec2。刚刚安装了nginx和php7 –