User Tools

Site Tools


doc:howto:http.nginx

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
doc:howto:http.nginx [2013/01/19 09:44]
orca
doc:howto:http.nginx [2014/11/29 11:51] (current)
tmomas nginx-syslog added
Line 1: Line 1:
-====== ​nginx ======+====== ​Nginx ======
  
-WIP, by trial and errorThis is what I did to make PHP5 to work.+[[http://​wiki.nginx.org/​|Nginx]] ​is a high-performance http-server with other functions as well. 
 +It is a perfect candidate ​to run on OpenWRT due to the performance and memory handling.
  
 ===== Installation ===== ===== Installation =====
Line 9: Line 10:
 </​code>​ </​code>​
  
-Note: nginx are not precompiled in barrier breaker release. Read notes+Of course there will be port issues if you installed LuCI before or after nginx, since LuCI package installs uhttpd, which also wants to claim port 80
- +So configuring and/or portforwarding may be neccessaryThere are ways to run LuCI with another http daemon but that is not coverd here
-Solution: Either try [[doc/techref/​opkg|force-depends]] on downloaded package from AA or [[doc/​howtobuild/​single.package|recompile]] for your specific device+For a quick fix, just change the uhttpd port to something else in ''​/etc/config/uhttpd''​.
- +
-[[http://downloads.openwrt.org/attitude_adjustment/​12.09-rc1/​|http://​downloads.openwrt.org/​attitude_adjustment/​12.09-rc1/​]] ARCH /​generic/​packages/​nginx_1.2.2-1_ARCH.ipk+
  
 ==== Configuration Files ==== ==== Configuration Files ====
-The configuration files resides in /etc/ folder, nginx own files are in their own folder /etc/nginx/+
 === nginx.conf === === nginx.conf ===
-/​etc/​nginx/​nginx.conf+ 
 +''​/​etc/​nginx/​nginx.conf''​ 
 <​code>​ <​code>​
 user nobody nogroup; user nobody nogroup;
Line 48: Line 49:
  gzip_vary on;  gzip_vary on;
  server {  server {
-         listen ​      80; +         listen ​      80; # Port, make sure it is not in conflict with another http daemon. 
-         server_name ​ YOUR_SERVER;​+         server_name ​ YOUR_SERVER;​ # Change this, reference -> http://​nginx.org/​en/​docs/​http/​server_names.html
  fastcgi_connect_timeout 300;  fastcgi_connect_timeout 300;
  fastcgi_send_timeout 300;  fastcgi_send_timeout 300;
Line 59: Line 60:
  client_body_timeout 10;  client_body_timeout 10;
  client_header_timeout 10;  client_header_timeout 10;
- send_timeout 60;+ send_timeout 60; # 60 sec should be enough, if experiencing a lot of timeouts, increase this.
  output_buffers 1 32k;  output_buffers 1 32k;
  postpone_output 1460;  postpone_output 1460;
  
- root ​  /​mnt/​data/​www;​+ root ​  /​mnt/​data/​www;​ # Your document root, where all public material is.
  
  location ~ \.php$ {  location ~ \.php$ {
  fastcgi_index ​ index.php;  fastcgi_index ​ index.php;
- fastcgi_param ​ SCRIPT_FILENAME ​ $document_root$fastcgi_script_name;​ 
  include ​       fastcgi_params;​  include ​       fastcgi_params;​
 + fastcgi_param ​ SCRIPT_FILENAME ​ $document_root$fastcgi_script_name;​
  
  if (-f $request_filename) {  if (-f $request_filename) {
Line 80: Line 81:
  
 === php.ini === === php.ini ===
-/​etc/​php.ini+''​/​etc/​php.ini''​
 <​code>​ <​code>​
 doc_root = "​YOUR/​DOCUMENT/​ROOT"​ doc_root = "​YOUR/​DOCUMENT/​ROOT"​
Line 88: Line 89:
  
 === fastcgi_params === === fastcgi_params ===
-Resides in /etc/nginx/.+''​/etc/nginx/fastcgi_params''​ 
 If for what ever reason it was modified or wasn'​t,​ this one will work. If for what ever reason it was modified or wasn'​t,​ this one will work.
 +
 <​code>​ <​code>​
 fastcgi_param ​ QUERY_STRING ​      ​$query_string;​ fastcgi_param ​ QUERY_STRING ​      ​$query_string;​
Line 115: Line 118:
 fastcgi_param ​ REDIRECT_STATUS ​   200; fastcgi_param ​ REDIRECT_STATUS ​   200;
 </​code>​ </​code>​
 +
 ===== Error Log ===== ===== Error Log =====
 Error log is your friend. Error log is your friend.
Line 120: Line 124:
  
 Read on nginx error log section for more information -> [[http://​wiki.nginx.org/​CoreModule#​error_log|nginx Core Module - Error Log]] Read on nginx error log section for more information -> [[http://​wiki.nginx.org/​CoreModule#​error_log|nginx Core Module - Error Log]]
 +
 +For nginx logging to syslog, see package ''​nginx-syslog''​.
 +
 ===== Notes ===== ===== Notes =====
 Make sure path's are correct for your case. Make sure path's are correct for your case.
  
 This setup works stable on [[toh/​tp-link/​tl-wr1043nd]],​ can tell tho that Attitude Adjustment 12.09-rc1 ar71xx package still works on this device - confirmed by CraXyOW3. This setup works stable on [[toh/​tp-link/​tl-wr1043nd]],​ can tell tho that Attitude Adjustment 12.09-rc1 ar71xx package still works on this device - confirmed by CraXyOW3.
doc/howto/http.nginx.1358585050.txt.bz2 · Last modified: 2013/01/19 09:44 by orca