Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

move nginx to its folder in ubuntu

  • Loading branch information...
commit 1c9f9e87c1f5774938c523fd542939122d323dd2 1 parent 5371d98
@shimondoodkin authored
View
23 my_enginx_config/etc/nginx/fastcgi_params
@@ -0,0 +1,23 @@
+
+fastcgi_param QUERY_STRING $query_string;
+fastcgi_param REQUEST_METHOD $request_method;
+fastcgi_param CONTENT_TYPE $content_type;
+fastcgi_param CONTENT_LENGTH $content_length;
+
+fastcgi_param SCRIPT_NAME $fastcgi_script_name;
+fastcgi_param REQUEST_URI $request_uri;
+fastcgi_param DOCUMENT_URI $document_uri;
+fastcgi_param DOCUMENT_ROOT $document_root;
+fastcgi_param SERVER_PROTOCOL $server_protocol;
+
+fastcgi_param GATEWAY_INTERFACE CGI/1.1;
+fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
+
+fastcgi_param REMOTE_ADDR $remote_addr;
+fastcgi_param REMOTE_PORT $remote_port;
+fastcgi_param SERVER_ADDR $server_addr;
+fastcgi_param SERVER_PORT $server_port;
+fastcgi_param SERVER_NAME $server_name;
+
+# PHP only, required if PHP was built with --enable-force-cgi-redirect
+fastcgi_param REDIRECT_STATUS 200;
View
211 my_enginx_config/etc/nginx/more_complex_example.txt
@@ -0,0 +1,211 @@
+# user and group to run as
+user ez ez;
+
+# number of nginx workers
+worker_processes 6;
+
+# pid of nginx master process
+pid /var/run/nginx.pid;
+
+# Number of worker connections. 1024 is a good default
+events {
+ worker_connections 1024;
+}
+
+# start the http module where we config http access.
+http {
+ # pull in mime-types. You can break out your config
+ # into as many include's as you want to make it cleaner
+ include /etc/nginx/mime.types;
+
+ # set a default type for the rare situation that
+ # nothing matches from the mimie-type include
+ default_type application/octet-stream;
+
+ # configure log format
+ log_format main '$remote_addr - $remote_user [$time_local] '
+ '"$request" $status $body_bytes_sent "$http_referer" '
+ '"$http_user_agent" "$http_x_forwarded_for"';
+
+ # main access log
+ access_log /var/log/nginx_access.log main;
+
+ # main error log
+ error_log /var/log/nginx_error.log debug;
+
+ # no sendfile on OSX
+ sendfile on;
+
+ # These are good default values.
+ tcp_nopush on;
+ tcp_nodelay off;
+ # output compression saves bandwidth
+ gzip on;
+ gzip_http_version 1.0;
+ gzip_comp_level 2;
+ gzip_proxied any;
+ gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml
+application/xml+rss text/javascript;
+
+
+ # this is where you define your mongrel clusters.
+ # you need one of these blocks for each cluster
+ # and each one needs its own name to refer to it later.
+ upstream mongrel {
+ server 127.0.0.1:5000;
+ server 127.0.0.1:5001;
+ server 127.0.0.1:5002;
+ }
+
+
+ # the server directive is nginx's virtual host directive.
+ server {
+ # port to listen on. Can also be set to an IP:PORT
+ listen 80;
+
+ # Set the max size for file uploads to 50Mb
+ client_max_body_size 50M;
+
+ # sets the domain[s] that this vhost server requests for
+ # server_name www.[engineyard].com [engineyard].com;
+
+ # doc root
+ root /data/ez/current/public;
+
+ # vhost specific access log
+ access_log /var/log/nginx.vhost.access.log main;
+
+ # this rewrites all the requests to the maintenance.html
+ # page if it exists in the doc root. This is for capistrano's
+ # disable web task
+
+ #######generaly i don not suggest to check file exists. disk is slow!!
+ if (-f $document_root/system/maintenance.html) {
+ rewrite ^(.*)$ /system/maintenance.html last;
+ break;
+ }
+
+ location / {
+ # needed to forward user's IP address to rails
+ proxy_set_header X-Real-IP $remote_addr;
+
+ # needed for HTTPS
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header Host $http_host;
+ proxy_redirect false;
+ proxy_max_temp_file_size 0;
+
+ # If the file exists as a static file serve it directly without
+ # running all the other rewite tests on it
+ if (-f $request_filename) { #######generaly i don not suggest to check file exists. disk is slow!!
+ break;
+ }
+
+ # check for index.html for directory index
+ # if its there on the filesystem then rewite
+ # the url to add /index.html to the end of it
+ # and then break to send it to the next config rules.
+ if (-f $request_filename/index.html) {
+ rewrite (.*) $1/index.html break;
+ }
+
+ # this is the meat of the rails page caching config
+ # it adds .html to the end of the url and then checks
+ # the filesystem for that file. If it exists, then we
+ # rewite the url to have explicit .html on the end
+ # and then send it on its way to the next config rule.
+ # if there is no file on the fs then it sets all the
+ # necessary headers and proxies to our upstream mongrels
+ if (-f $request_filename.html) { #######generaly i don not suggest to check file exists. disk is slow!!
+ rewrite (.*) $1.html break;
+ }
+
+ if (!-f $request_filename) { #######generaly i don not suggest to check file exists. disk is slow!!
+ proxy_pass http://mongrel;
+ break;
+ }
+ }
+
+ error_page 500 502 503 504 /500.html;
+ location = /500.html {
+ root /data/ez/current/public;
+ }
+ }
+
+ # This server is setup for ssl. Uncomment if
+ # you are using ssl as well as port 80.
+ server {
+ # port to listen on. Can also be set to an IP:PORT
+ listen 443;
+
+ # Set the max size for file uploads to 50Mb
+ client_max_body_size 50M;
+
+ # sets the domain[s] that this vhost server requests for
+ # server_name www.[engineyard].com [engineyard].com;
+
+ # doc root
+ root /data/ez/current/public;
+
+ # vhost specific access log
+ access_log /var/log/nginx.vhost.access.log main;
+
+ # this rewrites all the requests to the maintenance.html
+ # page if it exists in the doc root. This is for capistrano's
+ # disable web task
+ if (-f $document_root/system/maintenance.html) {
+ rewrite ^(.*)$ /system/maintenance.html last;
+ break;
+ }
+
+ location / {
+ # needed to forward user's IP address to rails
+ proxy_set_header X-Real-IP $remote_addr;
+
+ # needed for HTTPS
+ proxy_set_header X_FORWARDED_PROTO https;
+
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header Host $http_host;
+ proxy_redirect false;
+ proxy_max_temp_file_size 0;
+
+ # If the file exists as a static file serve it directly without
+ # running all the other rewite tests on it
+ if (-f $request_filename) { #######generaly i don not suggest to check file exists. disk is slow!!
+ break;
+ }
+
+ # check for index.html for directory index
+ # if its there on the filesystem then rewite
+ # the url to add /index.html to the end of it
+ # and then break to send it to the next config rules.
+ if (-f $request_filename/index.html) { #######generaly i don not suggest to check file exists. disk is slow!!
+ rewrite (.*) $1/index.html break;
+ }
+
+ # this is the meat of the rails page caching config
+ # it adds .html to the end of the url and then checks
+ # the filesystem for that file. If it exists, then we
+ # rewite the url to have explicit .html on the end
+ # and then send it on its way to the next config rule.
+ # if there is no file on the fs then it sets all the
+ # necessary headers and proxies to our upstream mongrels
+ if (-f $request_filename.html) { #######generaly i don not suggest to check file exists. disk is slow!!
+ rewrite (.*) $1.html break;
+ }
+
+ if (!-f $request_filename) { #######generaly i don not suggest to check file exists. disk is slow!!
+ proxy_pass http://mongrel;
+ break;
+ }
+ }
+
+ error_page 500 502 503 504 /500.html;
+ location = /500.html {
+ root /data/ez/current/public;
+ }
+ }
+
+
+}
View
193 my_enginx_config/etc/nginx/sites-enabled/default
@@ -0,0 +1,193 @@
+# You may add here your
+# server {
+# ...
+# }
+# statements for each of your virtual hosts
+keepalive_requests 1000;
+
+server {
+ listen 80 default;
+ server_name localhost;
+
+ access_log /var/log/nginx/localhost.access.log;
+ #access_log off;
+
+
+# location ~ ^/$ {
+# root /var/www/nginx-default;
+# #root /var/www/;
+# index index.html index.php;
+# }
+
+# location /doc {
+# root /usr/share;
+# autoindex on;
+# allow 127.0.0.1;
+# deny all;
+# }
+
+# location /images {
+# root /usr/share;
+# autoindex on;
+# }
+
+ #error_page 404 /404.html;
+
+ # redirect server error pages to the static page /50x.html
+ #
+ #error_page 500 502 503 504 /50x.html;
+ #location = /50x.html {
+ # root /var/www/nginx-default;
+ #}
+
+ # proxy the PHP scripts to Apache listening on 127.0.0.1:80
+ #
+ #location ~ \.php$ {
+ #proxy_pass http://127.0.0.1;
+ #}
+
+ # setup below some locations for your website
+
+ #some paths need to be piped directry like paths with rewrite,
+ # and paths you want node to serve when nginx is the default server for it.
+ location ~ ^/lib/
+ {
+# auth_basic "Hello, please login";
+ # auth_basic_user_file /var/www/htpasswd;
+
+ proxy_pass http://127.0.0.1:8000; # uncomment this for this port will work for the root / of the website
+ break;
+ }
+
+ location ~ ^/css/
+ {
+ # auth_basic "Hello, please login";
+ # auth_basic_user_file /var/www/htpasswd;
+
+ proxy_pass http://127.0.0.1:8000;
+ break;
+ }
+
+ location ~ ^/js/ # i server the css and js and images cached from memory from node js so mine is probably faster then nginx's
+ {
+ # auth_basic "Hello, please login";
+ # auth_basic_user_file /var/www/htpasswd;
+
+ proxy_pass http://127.0.0.1:8000;
+ break;
+ }
+
+ location ~ ^/img/
+ {
+# auth_basic "Hello, please login";
+ # auth_basic_user_file /var/www/htpasswd;
+
+ proxy_pass http://127.0.0.1:8000;
+ break;
+ }
+
+
+ # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
+ #
+
+ location ~ \.php$ {
+ #if ($uri !~ "^/uploads/") {
+ fastcgi_pass 127.0.0.1:9000;
+ fastcgi_index index.php;
+ fastcgi_param SCRIPT_FILENAME /var/www/nginx-default$fastcgi_script_name;
+ include fastcgi_params;
+ #}
+ break;
+ }
+
+ # to reload nginx settings type:
+ # nginx -s reload
+
+ # i prefer this instead fle not exist rout because this should work faster.
+ #location ~ \.(js|css|jpg|png|gif|html)$ {
+ # root /var/www/nginx-default;
+ # break;
+ #}
+
+
+ # this app called data, you might want several apps.
+ #location /data {
+ # proxy_pass http://127.0.0.1:8000;
+ #}
+
+ #location ~ ^/$ {
+ # root /var/www/nginx-default;
+ # index index.html index.php;
+ #}
+ #location ~ ^/. {
+ # root /var/www/nginx-default;
+ # index index.html index.php;
+ # if (!-f $request_filename) {
+ # proxy_pass http://127.0.0.1:8000; # uncomment this for this port will work for the root / of the website
+ # }
+ #}
+
+ #location / {
+ # root /var/www/nginx-default;
+ # index index.html index.php;
+ # if (!-f $request_filename) {
+ # proxy_pass http://127.0.0.1:8000; # uncomment this for this port will work for the root / of the website
+ # }
+ #}
+
+ location ~ \.(js|css|jpg|png|gif|html)$ {
+ root /var/www/nginx-default;
+ break;
+ }
+
+ location / {
+ root /var/www/nginx-default;
+ index index.html index.php;
+ proxy_pass http://127.0.0.1:8000; # uncomment this for this port will work for the root / of the website
+ }
+
+
+ # deny access to .htaccess files, if Apache's document root
+ # concurs with nginx's one
+ #
+ #location ~ /\.ht {
+ #deny all;
+ #}
+}
+
+
+# another virtual host using mix of IP-, name-, and port-based configuration
+#
+#server {
+#listen 8000;
+#listen somename:8080;
+#server_name somename alias another.alias;
+
+#location / {
+#root html;
+#index index.html index.htm;
+#}
+#}
+
+
+# HTTPS server
+#
+#server {
+#listen 443;
+#server_name localhost;
+
+#ssl on;
+#ssl_certificate cert.pem;
+#ssl_certificate_key cert.key;
+
+#ssl_session_timeout 5m;
+
+#ssl_protocols SSLv2 SSLv3 TLSv1;
+#ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
+#ssl_prefer_server_ciphers on;
+
+#location / {
+#root html;
+#index index.html index.htm;
+#}
+#}
Please sign in to comment.
Something went wrong with that request. Please try again.