【发布时间】:2017-10-31 04:36:38
【问题描述】:
我已经在 EC2 实例上克隆了我的 laravel 项目(类型 ubuntu 16.04)
之后我运行了composer install 命令
我已经根据我的本地机器更改了 /etc/nginx/site-available/default 配置
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html/myproject/public;
charset utf-8;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name myServerIpAddress;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
现在,当我打开我的服务器 IP 地址时,它会正确显示我的 / 路由,但是当我尝试打开 /login 或 /register 时,它显示找不到 404
我的 nginx 版本是 (1.10.0) 我的php版本是(7.0.18)
我也检查了日志文件,但没有显示任何错误
谢谢
【问题讨论】:
-
您是否按照此处的说明进行操作:laravel.com/docs/5.4/#web-server-configuration?
-
天哪,谢谢它成功了。只是好奇为什么这个配置在我的本地环境中工作。反正我以后会想办法的。再次感谢
标签: php ubuntu nginx amazon-ec2