Skip to content

Instantly share code, notes, and snippets.

@WaYdotNET
Forked from minostro/gist:11387989
Created May 29, 2016 15:43
Show Gist options
  • Save WaYdotNET/36dc72679fa3bb74108fddfe380840b5 to your computer and use it in GitHub Desktop.
Save WaYdotNET/36dc72679fa3bb74108fddfe380840b5 to your computer and use it in GitHub Desktop.
Configuring Nginx on Webfaction

1.- Get into the src folder, download & extract nginx source

  • cd ~/src
  • curl -O http://nginx.org/download/nginx-1.7.0.tar.gz
  • tar -xzvf nginx-1.7.0.tar.gz
  • cd nginx-1.7.0

2.- Configuring the source

./configure --prefix=$HOME/local/nginx
--sbin-path=$HOME/local/sbin/nginx
--conf-path=$HOME/local/etc/nginx.conf
--error-log-path=$HOME/logs/user/nginx/error.log
--http-log-path=$HOME/logs/user/nginx/access.log
--pid-path=$HOME/local/run/nginx/nginx.pid
--lock-path=$HOME/local/lock/nginx.lock
--http-client-body-temp-path=$HOME/tmp/nginx/client/
--http-proxy-temp-path=$HOME/tmp/nginx/proxy/
--http-fastcgi-temp-path=$HOME/tmp/nginx/fcgi/
--with-http_flv_module
--with-http_ssl_module
--with-http_gzip_static_module

3.- Compile & Install

  • make
  • make install

4.- Creating folders

  • mkdir -p ~/tmp/nginx/fcgi ~/tmp/nginx/proxy ~/tmp/nginx/client

5.- Modifying the Path

  • export PATH=/home/axion/local/sbin:$PATH
  • source ~/.bashrc

6.- Create a custom app on Webfaction

7.- The configuration file

  • mv ~/local/etc/nginx.conf ~/local/etc/nginx.conf.backup

8.- Edit the configuration file as needed & check it

  • nginx -t

9.- Start, Stopping & Reloading

  • nginx
  • nginx -s stop
  • nginx -s reload
  • nginx -t
#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;
sendfile on;
keepalive_timeout 65;
# APPLICATION !!!!!!!!!!
server {
listen 14287; # THIS PORT FROM WEBFACTION DASHBOARD
server_name frontend.skillask.com; # SERVER NAME ... only for log :D
charset utf-8;
client_max_body_size 1024M;
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
# STATIC FILE FOR APPLICATION
location ~ ^/(static|scripts|styles)/ {
root /home/erko/webapps/skillask_frontend_6_2_0/dist; # STATIC FOLDER
}
location / {
proxy_pass http://0.0.0.0:1337; # NODE APPLICATION ... CHANGE PORT !!!! IF OUTLINEJS IS PATCHED!!!!
}
#charset koi8-r;
#access_log logs/host.access.log main;
}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment