• I have a ton of posts trying to gett his working to no avail
    I have tried and currently have the plugin for this installed from
    WordPress Nginx compatibility plugin

    and here is the nginx.conf file i have tired editing over and over

    #user http;
    worker_processes  1;
    #error_log  logs/error.log;
    #error_log  logs/error.log  notice;
    #error_log  logs/error.log  info;
    #pid        logs/nginx.pid;
    
    events {
        worker_connections  1024;
    } 
    
    http {
        include       mime.types;
        default_type  application/octet-stream;
        #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
        #                  '$status $body_bytes_sent "$http_referer" '
        #                  '"$http_user_agent" "$http_x_forwarded_for"';
        #access_log  logs/access.log  main;
        sendfile        on;
        keepalive_timeout  15;
        gzip  on;
        gzip_comp_level 1;
    
    server {
            listen       80;
            server_name  localhost;
            root /srv/http;
    # enforce www (exclude certain subdomains)
        #if ($host !~* ^(www|subdomain))
        #{
        #   rewrite ^/(.*)$ $scheme://www.$host/$1 permanent;
        #}
    
        # enforce NO www
        if ($host ~* ^www\.(.*))
        {
            set $host_without_www $1;
            rewrite ^/(.*)$ $scheme://$host_without_www/$1 permanent;
        }
    
        # unless the request is for a valid file, send to bootstrap
        if (!-e $request_filename)
        {
            rewrite ^(.+)$ /index.php?q=$1 last;
        }
    
        # catch all
        error_page 404 /index.php;
    
        # use fastcgi for all php files
        location ~ \.php$
        {
            fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include /etc/nginx/fastcgi_params;
        }
        location /phpmyadmin {
            rewrite ^/* /phpMyAdmin last;
        }
    
    	location / {
            root /srv/http;
            index index.php;
        }
    
        }
    }

    Can anyone point me in the right direction ?

Viewing 1 replies (of 1 total)
  • Please remove the following lines in your configuration…

    # unless the request is for a valid file, send to bootstrap
        if (!-e $request_filename)
        {
            rewrite ^(.+)$ /index.php?q=$1 last;
        }

    And then add the following in your location / block…

    try_files $uri $uri/ /index.php;

    This should take care of the pretty permalinks.

    BTW, what happens to your site at the moment with your original code?

Viewing 1 replies (of 1 total)
  • The topic ‘Nginx and pretty permalinks’ is closed to new replies.