location ^~ /utils/add-foto.php {
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_n$
auth_basic "Hello, Manager";
auth_basic_user_file /etc/nginx/htpasswd;
}
4. После проверки доступа все равно надо указывать обработчик php, иначе файл будет скачиваться.
location / {
try_files $uri $uri/ /index.php?$args;
}
location ^~ /utils/add-foto.php {
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
auth_basic "Hello, Менеджер";
auth_basic_user_file /etc/nginx/htpasswd;
}
root@delfatour:/etc/nginx# service nginx status
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2017-12-19 02:27:35 EST; 1h 7min ago
Docs: man:nginx(8)
Process: 5855 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=0/SUCCESS)
Process: 5859 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 5858 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 5862 (nginx)
Tasks: 3 (limit: 4915)
CGroup: /system.slice/nginx.service
├─5862 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
├─5863 nginx: worker process
└─5864 nginx: cache manager process
Dec 19 02:27:35 delfatour.xen.sim-networks.com systemd[1]: Starting A high performance web server and a reverse proxy server...
Dec 19 02:27:35 delfatour.xen.sim-networks.com systemd[1]: Started A high performance web server and a reverse proxy server.
Unit php-fpm.service could not be found.
require("phpDocx.php");
$phpdocx = new phpdocx("template.docx");
$phpdocx->assign("#TITLE1#","Pet shop list");
$phpdocx->assignNestedBlock("pets",array(array("#PETNAME#"=>"Rex")),array("members"=>1));
$phpdocx->assignNestedBlock("pets",array(array("#PETNAME#"=>"Rox")),array("members"=>2));
$phpdocx->download("test.docx");
я новичек вообще то, не до конца понимаю, почему