January 21, 2017 · Laravel Nginx Server

LEMP Nginx Sample Laravel Config

#config file for example.com
server {
# Replace this port with the right one for your requirements
        listen 80;  #could also be
# Multiple hostnames separated by spaces.  Replace these as well.
                server_name example.com;

        client_max_body_size 512M;
        root /var/www/example.com/public;
        access_log      /var/www/logs/example.com.access.log;
        error_log       /var/www/logs/example.com.error.log;
        allow all;

        fastcgi_read_timeout 300;

        index index.php index.html index.htm;
        location ~ \.php$ {
                fastcgi_pass unix:/run/php/php7.0-fpm.sock;                             
                include snippets/fastcgi-php.conf;                                      

        location / {
                try_files $uri $uri/ /index.php?$query_string;
#config file for example.com