N
N
navion2013-01-21 12:10:47
PHP
navion, 2013-01-21 12:10:47

Make Symfony and nginx friends?

After enabling the configuration from here , almost everything worked, except for restricting access to the admin panel located at site_name/admin.
In Apache this is implemented via admin/.htaccess:

AuthType Basic
AuthName "Restricted access"
AuthUserFile /etc/httpd/htpasswd/sitename
Require user admin manager
Order Deny,Allow
Deny from all
Allow from 192.168.0.0/24

I’m trying to do it by analogy using location (only IP restrictions are enough for a start):
location /admin {
rewrite ^(.*) /admin/index.php$1 last;
allow 192.168.0.0/24;
deny all;
}

But in this case, only static is not transferred, and the content created by PHP is available to the entire Internet.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
U
UncleByte, 2013-01-22
@navion

In a good way, the config from the link above needs to be rewritten taking into account the recommendations from here - wiki.nginx.org/Pitfalls
In this case, you do not need to specify anything in location /admin except, in fact, the access settings.

U
UncleByte, 2013-01-24
@UncleByte

I would still rewrite this part

location ~ \.php$ {
        try_files $uri index.php;
        include /etc/nginx/fastcgi_params;
        fastcgi_pass 127.0.0.1:9000;
  fastcgi_index index.php;
  fastcgi_intercept_errors on;
  fastcgi_read_timeout 600;
  fastcgi_send_timeout 600;
  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  fastcgi_param SCRIPT_NAME $fastcgi_script_name;
  fastcgi_param QUERY_STRING $args;
    }

That is, without setting additional variables.

U
UncleByte, 2013-01-24
@UncleByte

And you can see what kind of uri there are in general? Just to understand.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question