Last active
February 5, 2018 08:17
-
-
Save dhimasanb/10ca78409dfdabf7449c13fbcbfe025d to your computer and use it in GitHub Desktop.
Simple Config Laravel + Nginx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
# Port that the web server will listen on. | |
listen 8081 default_server;; | |
# listen [::]:80 default_server ipv6only=on; | |
# SSL Config | |
# | |
# listen 443 ssl default_server; | |
# listen [::]:443 ssl default_server; | |
# The location of our projects public directory. | |
root /var/www/laravel/public; | |
# Point index to the Laravel front controller. | |
index index.php index.html index.htm index.nginx-debian.html | |
# Host that will serve this project. | |
server_name localhost; | |
# Useful logs for debug. | |
access_log /var/www/laravel/access.log; | |
error_log /var/www/laravel/error.log; | |
rewrite_log on; | |
# The location of our projects public directory. | |
location / { | |
# try_files $uri $uri/ =404; | |
# URLs to attempt, including pretty ones. | |
try_files $uri $uri/ /index.php?$query_string; | |
} | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini | |
# With php5-cgi alone: | |
#fastcgi_pass 127.0.0.1:9000; | |
# With php5-fpm: | |
fastcgi_pass unix:/var/run/php/php5.6-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
} | |
// Check Ports | |
netstat -ntlp | grep LISTEN | |
// Test nginx | |
sudo nginx -t | |
// Link | |
sudo ln -s /etc/nginx/sites-available/laravel /etc/nginx/sites-enabled/ | |
// Deploy angular | |
ng build --base-href "/admin" --deploy-url "admin/" | |
// Deploy angular production | |
ng build --prod --base-href "/admin" --deploy-url "admin/" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment