"Primary script unknown" wp-login.php

nano nanotek at bsdbox.co
Fri Jan 10 10:11:30 UTC 2014

On 10/01/2014 3:46 AM, Miguel Clara wrote:
>> I resolved this problem by making the /wordpress directory the server root.
>> However, I now have the problem of /usr/local/www/phpMyAdmin being
>> inaccessible, due to the same error.
> You can, and its probably best to use:
> fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
> Also you should have those to in different nginx config files, its far
> better to read/modify if needed.
> In any case the .php block should work has long has the "root" is set
> right in the different locations!

Thank you, Miguel. I have implemented your advice to use $document_root 
and I have also split configuration into separate files[0] as per your 

user  www www;
worker_processes 3;
worker_priority 15;
pid /var/run/nginx.pid;
error_log  /var/log/nginx-error.log  crit;
events {
   worker_connections  1024;
   accept_mutex on;
   use kqueue;
http {
   include       conf.d/options;
   include       mime.types;
   default_type  application/octet-stream;
   access_log  /var/log/nginx-access.log main buffer=32k;
   include sites/*.on;
+----[ eof ]

server {
         server_name site1.com www.site1.com;
         add_header  Cache-Control "public";
         add_header  X-Frame-Options "DENY";
         limit_req   zone=gulag burst=200 nodelay;
         expires     max;
         listen 80;
         listen 443 ssl;
         include conf.d/ssl;
         root /usr/local/www/site1;
         index index.html index.htm index.php;
         location = /favicon.ico { return 204; }
location ~* 
{ deny all; }
location ~ /\. {
	deny all;
	access_log off;
	log_not_found off;
location / {
	root /usr/local/www/site1/wordpress;
	try_files $uri $uri/ /index.php?$args;
	location ~ \.php$ { include conf.d/php-fpm; }
include conf.d/phpmyadmin;
location /management { root /usr/local/www/site1/administration; }
location ~ \.php$ { include conf.d/php-fpm; }
error_page   500 502 503 504  /50x.html;
location = /50x.html { root   /usr/local/www/nginx-dist; }
+----[ eof ]

location ^~ /phpmyadmin {
         access_log  off;
         rewrite ^  /phpMyAdmin/ permanent;
location /phpMyAdmin {
         root /usr/local/www;
         index index.php index.html;
                 location ~ ^/phpMyAdmin/(.*\.php)$ {
                         root /usr/local/www/;
                         include conf.d/php-fpm;
+----[ eof ]

fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
try_files  $uri = 404;
fastcgi_split_path_info  ^(.+\.php)(.*)$;
fastcgi_index  index.php;
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;
fastcgi_param GEOIP_COUNTRY_CODE $geoip_country_code;
fastcgi_param GEOIP_COUNTRY_NAME $geoip_country_name;
include fastcgi_params;
+----[ eof ]

ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_certificate /path/to/crt-chain.pem;
ssl_certificate_key /path/to/key.pem;
ssl_dhparam /path/to/dhparam4096.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ecdh_curve secp256r1;
ssl_stapling on;
ssl_stapling_verify on;
ssl_prefer_server_ciphers on;
+----[ eof ]

client_body_timeout  5s;
client_header_timeout  5s;
keepalive_timeout  75s;
send_timeout  15s;
charset  utf-8;
#default_type  application/octet-stream;
#include  /etc/mime.types;
gzip  off;
gzip_static  on;
gzip_proxied  any;
ignore_invalid_headers  on;
keepalive_requests  50;
keepalive_disable  none;
max_ranges  1;
msie_padding  off;
open_file_cache  max=1000 inactive=2h;
open_file_cache_errors  on;
open_file_cache_min_uses  1;
open_file_cache_valid  1h;
output_buffers  1 512;
postpone_output  1440;
read_ahead  512K;
recursive_error_pages  on;
reset_timedout_connection  on;
sendfile  on;
server_tokens  off;
server_name_in_redirect  off;
source_charset  utf-8;
tcp_nodelay  on;
tcp_nopush  off;
gzip_disable  "MSIE [1-6]\.(?!.*SV1)";
limit_req_zone  $binary_remote_addr  zone=gulag:1m   rate=60r/m;
log_format  main  '$remote_addr $host $remote_user [$time_local] 
"$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" 
$ssl_cipher $request_time';
+----[ eof ]

syn.bsdbox.co <- for dummies

More information about the nginx mailing list