Skip to content

Instantly share code, notes, and snippets.

@andrewhl
Created June 4, 2014 12:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewhl/d941fc88f9eea47bda19 to your computer and use it in GitHub Desktop.
Save andrewhl/d941fc88f9eea47bda19 to your computer and use it in GitHub Desktop.
I'm running Laravel on an AWS EC2 instance, and I'm trying to use Nginx. I get a 403 Forbidden HTTP response when I try to visit the public IP address.
server {
listen 80 default_server;
# listen [::]:80 default_server ipv6only=on;
root /home/ubuntu/public_html;
index index.html index.htm index.php;
# Make site accessible from http://localhost/
server_name 54.23.4.31;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php$is_args$args;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment