Category Archives: Hosting

varnish can not change port

If you want to change to 8888:

grep -R 'ExecStart=/usr/sbin/varnishd' /etc/
/etc/systemd/system/multi-user.target.wants/varnish.service:ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a :8888 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m

systemctl daemon-reload
systemctl restart varnish.service

nginx allow only index.php

upstream _php {
server unix:/var/run/php-fpm/php-fpm.sock;
}

server {
server_name 192.168.1.100;

root /path/to/root;
index index.php;

include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
location / { deny all; }
location = / { }
location = /index.php { fastcgi_pass _php; }

location /phpmyadmin/ { }
location ~ ^/phpmyadmin/.*\.php$ { fastcgi_pass _php; }
}

FastCGI sent in stderr: “Primary script unknown” while reading response header from upstream, client

File not found.
Make sure SCRIPT_FILENAME same location like root:

server {
server_name 192.168.1.100;
location / {
root /var/www/html;

location ~* \.php$ {
fastcgi_pass unix:/var/run/php/php.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
}
}