Monday, December 18, 2017

Config Nginx on Ubuntu 16.02

Hi, 
When deploy a ZF3 app on Nginx, you need to config a server like this.

server {
listen 80;
listen [::]:80;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /var/www/yourwebsite.com/public;
# Add index.php to the list if you are using PHP 
index index.php index.html;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
server_name yourwebsite.com;

try_files $uri $uri/ @notfile;
location @notfile {        rewrite ^(.*) /index.php last;      }

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one

location ~ /\.ht {
deny all;
}
}

No comments:

Post a Comment

Sublime Text 3 Usage

1. Download and install sublime 2. Install some essential packages: - Seti.sublime-theme  : theme beautiful - HTML-CSS-JS Prettify (nee...