|
|
Hi, basic on http://wiki.nginx.org/Pitfalls, I want to ask my directives like this :
This directive on balancer :
upstream static {
server 10.100.100.43:80; # Zenoir03
}
server {
server_name static.antituhan.com;
access_log /log/nginx/static.antituhan.access.log;
error_log /log/nginx/static.antituhan.error.log;
location / {
proxy_pass http://static;
}
}
And then, this directives on backend :
server {
server_name localhost;
listen 80;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log debug;
root /home/antituhan/static;
location / {
}
location ~ .php$ {
fastcgi_pass backend-static;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
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_intercept_errors on;
fastcgi_ignore_client_abort off;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}
}
upstream backend-static {
server 127.0.0.1:9000;
}
I want to give a subdomain like this http://static.antituhan.com/cdn, and /cdn will have a root dir to /home/antituhan/public_html/, and now I use symlink to static :
$ ln -s /home/antituhan/public_html /home/antituhan/static/cdn So, I can access the domain like this http://static.antituhan.com/cdnIf I don't use symlink, is it possible to add another directive on nginx? And if is not possible, is it safe for nginx directive? Thank you
[daemon@antituhan.com ~]#
|
|
So, what should I do Cliff ? Which directive should I use for it ?
[daemon@antituhan.com ~]#
|
|
On Tue, May 01, 2012 at 09:21:13AM -0700, Cliff Wells wrote:
> On Tue, 2012-05-01 at 02:36 -0700, antituhan wrote:
Hi there,
> > this :
> >
> > This directive on balancer :
> >
> >
> > And then, this directives on backend :
I think Cliff's point is that the nabble.com interface that you are
using to post, seems to be corrupting what you post before sending it
to the nginx mailing list.
So anyone reading your message anywhere other than at nabble.com doesn't
see any of the configuration that you intended to show.
For the benefit of the list archives (and having more people who might
be able to offer help), could you repeat your first post, but do whatever
it takes to get it sent to the mailing list intact?
(That might involve some setting saying "this is plain text", perhaps.)
f
--
Francis Daly [hidden email]
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
|
|
This post was updated on .
If using alias, what the root document directive? Because public_html is outside the /home/antituhan/static. I've tried using alias /home/antituhan/public_html but the nginx shows errors not found. Any solution ?
Cliff Wells wrote
Perhaps an alias?
location /cdn/ {
alias /home/antituhan/public_html/;
}
Cliff
On Tue, 2012-05-01 at 02:36 -0700, antituhan wrote:
> Hi, basic on http://wiki.nginx.org/Pitfalls, I want to ask my directives like
> this :
>
> This directive on balancer :
>
>
> And then, this directives on backend :
>
>
> I want to give a subdomain like this http://static.antituhan.com/cdn, and
> /cdn will have a root dir to /home/antituhan/public_html/, and now I use
> symlink to static :
>
>
> So, I can access the domain like this http://static.antituhan.com/cdn>
> If I don't use symlink, is it possible to add another directive on nginx?
> And if is not possible, is it safe for nginx directive? Thank you
>
> -----
> [ [hidden email] ~]#
> --
> View this message in context: http://nginx.2469901.n2.nabble.com/Is-it-possible-using-multiple-directive-on-different-root-location-Without-Symlinks-tp7516384.html> Sent from the nginx mailing list archive at Nabble.com.
>
> _______________________________________________
> nginx mailing list
> [hidden email]> http://mailman.nginx.org/mailman/listinfo/nginx_______________________________________________
nginx mailing list
[hidden email]http://mailman.nginx.org/mailman/listinfo/nginx
[daemon@antituhan.com ~]#
|
|
On Tue, 2012-05-01 at 19:20 -0700, antituhan wrote:
> If using alias, what the root document directive? Becasue public_html is
> outside the /home/antituhan/static. I've tried using alias
> /home/antituhan/public_html but the nginx shows errors not found. Any
> solution ?
Pay attention to the slashes. /home/antituhan/static is not the same
as /home/antituhan/static/ for an alias.
If you could share your error log, it would be helpful.
The following works for me:
server {
listen localhost:80;
root /var/www/test;
location / {
index index.html;
}
location /cdn/ {
alias /var/www/static_html/;
}
}
index.html has <img src="/cdn/1.jpg" /> and it shows up fine.
Regards,
Cliff
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
|
|
How about php directive cliff ? I still get errors, my full directive like this http://fpaste.org/TOW3/And i have a index.php on /home/antituhan/public_html to be triggered by another upstream outsite with http://static.antituhan.com/cdnize/index.php?q=datahere and it says not found. Is my .php directive wrong ?
Thank you
Cliff Wells wrote
On Tue, 2012-05-01 at 19:20 -0700, antituhan wrote:
> If using alias, what the root document directive? Becasue public_html is
> outside the /home/antituhan/static. I've tried using alias
> /home/antituhan/public_html but the nginx shows errors not found. Any
> solution ?
Pay attention to the slashes. /home/antituhan/static is not the same
as /home/antituhan/static/ for an alias.
If you could share your error log, it would be helpful.
The following works for me:
server {
listen localhost:80;
root /var/www/test;
location / {
index index.html;
}
location /cdn/ {
alias /var/www/static_html/;
}
}
index.html has  and it shows up fine.
Regards,
Cliff
_______________________________________________
nginx mailing list
[hidden email]http://mailman.nginx.org/mailman/listinfo/nginx
[daemon@antituhan.com ~]#
|
|
On Thu, May 03, 2012 at 05:59:54AM -0700, antituhan wrote:
Hi there,
> How about php directive cliff ? I still get errors, my full directive like
> this http://fpaste.org/TOW3/The important part here is that your top-level location{} directives are
location /
location /cdnize/
location ~ .php$
Each request will be handled by exactly one of those blocks.
> And i have a index.php on /home/antituhan/public_html to be triggered by
> another upstream outsite with
> http://static.antituhan.com/cdnize/index.php?q=datahere and it says not
> found. Is my .php directive wrong ?
The request for /cdnize/index.php would be handled by the "location ~
.php$" block.
In there, you have
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
and $document_root is "root", which is inherited from the
root /home/antituhan/static;
directive at server level. So this request ends up (with the fastcgi
server) looking for the file /home/antituhan/static/cdnize/index.php,
which is presumably not what you want.
Probably you'll want to look at nesting a php location inside the /cdnize/
one. And then moving the current php location to be inside the / one.
So you will probably need to have two or more locations that handle php,
which each use a fastcgi_pass directive.
I'm sure there are recent examples of this set-up on the mailing list.
Good luck with it,
f
--
Francis Daly [hidden email]
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
|
|
So, how to solve the fastcgi php path with $document_root directive? By using fix path like /home/antituhan/static + multiple fastcgi directive or any directive to solve this issue?
Francis Daly wrote
On Thu, May 03, 2012 at 05:59:54AM -0700, antituhan wrote:
Hi there,
> How about php directive cliff ? I still get errors, my full directive like
> this http://fpaste.org/TOW3/The important part here is that your top-level location{} directives are
location /
location /cdnize/
location ~ .php$
Each request will be handled by exactly one of those blocks.
> And i have a index.php on /home/antituhan/public_html to be triggered by
> another upstream outsite with
> http://static.antituhan.com/cdnize/index.php?q=datahere and it says not
> found. Is my .php directive wrong ?
The request for /cdnize/index.php would be handled by the "location ~
.php$" block.
In there, you have
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
and $document_root is "root", which is inherited from the
root /home/antituhan/static;
directive at server level. So this request ends up (with the fastcgi
server) looking for the file /home/antituhan/static/cdnize/index.php,
which is presumably not what you want.
Probably you'll want to look at nesting a php location inside the /cdnize/
one. And then moving the current php location to be inside the / one.
So you will probably need to have two or more locations that handle php,
which each use a fastcgi_pass directive.
I'm sure there are recent examples of this set-up on the mailing list.
Good luck with it,
f
--
Francis Daly [hidden email]_______________________________________________
nginx mailing list
[hidden email]http://mailman.nginx.org/mailman/listinfo/nginx
[daemon@antituhan.com ~]#
|
|
On Thu, May 10, 2012 at 09:58:10PM -0700, antituhan wrote:
Hi there,
> So, how to solve the fastcgi php path with $document_root directive? By using
> fix path like /home/antituhan/static + multiple fastcgi directive or any
> directive to solve this issue?
If this part:
> > Probably you'll want to look at nesting a php location inside the /cdnize/
> > one. And then moving the current php location to be inside the / one.
> >
> > So you will probably need to have two or more locations that handle php,
> > which each use a fastcgi_pass directive.
is unclear, please say so.
After that:
* what did you do?
* what did you see?
* what did you expect to see?
(As in: show your config; and show one url that you tested that did not
respond as you wanted.)
f
--
Francis Daly [hidden email]
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
|
|
Hi F,
Yup, i want the fastcgi server to process the .php files. I've tried to set like this
location /test/ {
root /something/;
}
While I access http://static.antituhan.com/test/tehbotol.php the error log shows that tehbotol.php can't found on /something/test/tehbotol.php
[daemon@antituhan.com ~]#
|
|
tehbotol.php content is :
<?php phpinfo(); ?>
[daemon@antituhan.com ~]#
|
|