Skip to content

Instantly share code, notes, and snippets.

@qzm
Last active June 26, 2017 07:27
Show Gist options
  • Save qzm/6ec2cf1984e3d7f436476373ec8c7feb to your computer and use it in GitHub Desktop.
Save qzm/6ec2cf1984e3d7f436476373ec8c7feb to your computer and use it in GitHub Desktop.
React.js Vue.js Nginx configuration
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
server_tokens off;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_comp_level 5;
gzip_types application/javascript text/plain application/x-javascript text/css application/xml text/javascript;
server {
listen 80;
server_name localhost;
root /www/html;
charset utf-8;
# access_log logs/host.access.log main;
location / {
try_files $uri /index.html;
}
location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|js|css)$ {
gzip_static on;
expires max;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment