Jump to content


Photo
- - - - -

activate ngnix help....


  • Please log in to reply
11 replies to this topic

#1 apple82

apple82

    Member

  • Members
  • PipPipPipPip
  • 300 posts
  • LocationSpain

Posted 30 October 2013 - 08:59 PM

Hello, I installed the ngnix and searching the forum I created a file called and I put in:
 
server {
listen 80;
server_name example.com www.example.com;
client_max_body_size 1024m;

location / {
root /path_to_your_avs_dir;
index index.php index.html index.htm;


if ($http_host ~* "^example.com"){
set $rule_0 1$rule_0;
}
if ($rule_0 = "1"){
rewrite ^/(.*)$ http://www.example.com/$1 permanent;
break;
}
if (!-f $request_filename){
set $rule_1 1$rule_1;
}
if (!-d $request_filename){
set $rule_1 2$rule_1;
}
if ($rule_1 = "21"){
rewrite /.* /loader.php last;
}

}

location ~ \.flv$ {
flv;
root /path_to_your_avs_dir;

}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

location ~ \.php$ {
root /path_to_your_avs_dir;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index loader.php;
fastcgi_param SCRIPT_FILENAME /path_to_your_avs_dir$fastcgi_script_name;
include fastcgi_params;
}

}
 
but still when I enter photos example http://www.domain/photo/381/
 
I get error:
 
404 Not Found
 
nginx
 
 
any solution?
 
Thank you.
 
post ngnix:
 

Edited by apple82, 30 October 2013 - 09:01 PM.


#2 Kernel

Kernel

    Senior Member

  • Members
  • PipPipPipPip
  • 342 posts

Posted 02 November 2013 - 02:40 PM

Can you post the error from error.log? 

 

The configuration should be ok (no secure links & traffic shaping for videos but it should be ok for a small site). 

Now days there is a new configuration with try_links. 



#3 apple82

apple82

    Member

  • Members
  • PipPipPipPip
  • 300 posts
  • LocationSpain

Posted 02 November 2013 - 05:01 PM

Can you post the error from error.log? 

 

The configuration should be ok (no secure links & traffic shaping for videos but it should be ok for a small site). 

Now days there is a new configuration with try_links. 

 

no log file
 
the error that came out was:
 
404 Not Found
nginx

 

if you want to activate it on my other site and see the error?



#4 Kernel

Kernel

    Senior Member

  • Members
  • PipPipPipPip
  • 342 posts

Posted 03 November 2013 - 06:15 PM

turn on the error log and then write the log please



#5 apple82

apple82

    Member

  • Members
  • PipPipPipPip
  • 300 posts
  • LocationSpain

Posted 03 November 2013 - 08:08 PM

turn on the error log and then write the log please

 

enable logging on the avs?
 
 as ?


#6 apple82

apple82

    Member

  • Members
  • PipPipPipPip
  • 300 posts
  • LocationSpain

Posted 15 February 2014 - 03:17 PM

turn on the error log and then write the log please

 

Hello kernel, I have a vps look and bandwidth is 20mbps 
and always peaked, 
 
if you install the lighttpd would drop me or I would do the same? 
 
Thank you.


#7 Damien

Damien

    Junior Member

  • Members
  • PipPipPip
  • 81 posts

Posted 15 February 2014 - 05:22 PM

20*1000/8/1024 = 2.44 Megabytes per second. That's all your connection can do, upgrade it. It's maxed out.

http://www.webhostin...ad.php?t=390833


Edited by Damien, 15 February 2014 - 05:26 PM.


#8 apple82

apple82

    Member

  • Members
  • PipPipPipPip
  • 300 posts
  • LocationSpain

Posted 08 March 2014 - 02:50 PM

20*1000/8/1024 = 2.44 Megabytes per second. That's all your connection can do, upgrade it. It's maxed out.

http://www.webhostin...ad.php?t=390833

ok thanks!



#9 Damien

Damien

    Junior Member

  • Members
  • PipPipPip
  • 81 posts

Posted 07 June 2014 - 05:18 AM

np

 

This is a 100% fully working nginx configuration from my own websites with correct rewrite rules, support for nginx secure_link module, streaming media enabled and protection of certain folders & direct linking to video files if they know the path behind the hash. Take what you need.

 

be sure to set 

$secure_link_expires.$file.SECRET_NUMBERS_HERE;

in the config. Also watch nginx error log as you set all the required paths below to point at your own website. I don't use flv files but the stanza is still included below, and/or commented out.

server {
listen 80;
server_name www.yourdomain.com yourdomain.com;
error_log /var/log/AVSerror.log warn;
root /path/to/website/public_html;

# HOW DO WE REWRITE AVS? try_files @rewrite
location / {
index index.html index.htm index.php;
try_files $uri $uri/ @rewrite;
error_page 500 502 503 504 /error.html;
autoindex off;
}

# REWRITE LOCATION;
location @rewrite {
rewrite ^(.*)$ /index.php$1;
rewrite ^(.*)$ /loader.php;
}

# SECURE LINK FLV
# location ~ ^/videos/(?<secure>[\w\-=]+,\d+)(?<file>/.*\.flv)$ {
# secure_link $secure;
# secure_link_md5 $secure_link_expires.$file.543210;
# if ($secure_link = "0") { return 410; }
# alias /path/to/website/public_html/media/videos$file;
# flv;
# }

# SECURE LINK MP4
location ~ ^/videos/(?<secure>[\w\-=]+,\d+)(?<file>/.*\.mp4)$ {
secure_link $secure;
secure_link_md5 $secure_link_expires.$file.543210;
if ($secure_link = "0") { return 410; }
alias /path/to/website/public_html/media/videos$file;
mp4;
}

# DENY DIRECT LINKS TO MP4 FILES
location ~ /media/(.+)\.mp4$ {
root /path/to/website/public_html;
deny all;
}

# FASTCGI FOR PHP-FPM
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
include fastcgi_params;
}

# ADD SOME EXPIRE TIME FOR IMAGES
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 1y;
log_not_found off;
}

# ENABLE PLAYER SEEKING IN MP4
location /media/videos/hd/ {
mp4;
mp4_buffer_size 1m;
mp4_max_buffer_size 5m;
root /path/to/website/public_html;
}

# ENABLE PLAYER SEEKING IN MP4 IPHONE FILES
# location /media/videos/iphone/ {
# mp4;
# mp4_buffer_size 1m;
# mp4_max_buffer_size 5m;
# root /path/to/website/public_html;
# }

# ENABLE PLAYER SEEKING IN FLV FILES
# location /media/videos/flv/ {
# flv;
# root /path/to/website/public_html;
# }

# PROTECTED
location ~*.(.htaccess|include|media|tmp|scripts|plugins|classes|po|sh|.*sql|tpl(.php)?|xtmpl)$ {
deny all;
}

Edited by Damien, 08 June 2014 - 04:59 PM.


#10 theone

theone

    Senior Member

  • Members
  • PipPipPipPip
  • 371 posts

Posted 07 June 2014 - 12:48 PM

I would recommend adding using limit_rate and limit_conn in your config file.

 

This will save you a great deal of bandwidth as it will limit streaming / downloading of video files and you can also specify the max number of simultaneous connections to video files per IP. 

 

I'd also add a deny all to the template files otherwise .tpl files can be accessed directly.

 

You might also want to add gzip and upload_progress.


  • Damien likes this

#11 Damien

Damien

    Junior Member

  • Members
  • PipPipPip
  • 81 posts

Posted 08 June 2014 - 04:39 PM

I would recommend adding using limit_rate and limit_conn in your config file.

 

This will save you a great deal of bandwidth as it will limit streaming / downloading of video files and you can also specify the max number of simultaneous connections to video files per IP. 

 

I'd also add a deny all to the template files otherwise .tpl files can be accessed directly.

 

You might also want to add gzip and upload_progress.

 

Thanks for the tips, going to investigate them all and do the tpl protection right away, I gzip global from the nginx config itself.

location ~*.(.htaccess|include|tmp|media|scripts|plugins|classes|po|sh|.*sql|tpl(.php)?|xtmpl)$ {
deny all;
}

Edited by Damien, 08 June 2014 - 04:59 PM.


#12 apple82

apple82

    Member

  • Members
  • PipPipPipPip
  • 300 posts
  • LocationSpain

Posted 27 June 2014 - 09:15 PM

hello again after so long I install Lighttpd with ngnix 
 
but I am not able to find the correct code set. 
 
need support online payment for this. 
 
contact if interested.