Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi smoo, thanks for the css info, that did the trick.

    Thread Starter ansonl

    (@ansonl)

    I posted on rtCamp’s forums and have gotten the problem partially solved for those who are wondering.

    https://rtcamp.com/support/topic/accessing-non-wordpress-directory-in-website-root/#post-38522

    Thread Starter ansonl

    (@ansonl)

    Thanks for the help, after adding in the nested~ \.php block, the PHP files inside the /api directory work perfectly, however when accessing static text files, Nginx returns a nginx 404 error page instead of the wordpress error now.
    For example, accessing file located at /api/newest.txt returns 404 whereas accessing /api/newest.plist serves the actual plist file which the browser downloads.

    Modified config following the pastebin example below (I have removed the try_files option for /api, is try_file only necessary for PHP files? Adding try_files doesn’t seem to make a difference.):

    server {
        server_name  www.geometrystash.com;
        rewrite ^(.*) http://geometrystash.com$1 permanent;
    }
    
    server {
            listen 80;
            server_name geometrystash.com;
            root /var/www/geometrystash.com/htdocs/blog;
            index index.php;
    		include /etc/nginx/security;
    
    # Logging --
    access_log  off;
    error_log  /var/log/nginx/geometrystash.com.error.log warn;
    
            location = /favicon.ico {
                    log_not_found off;
                    access_log off;
            }
    
            location = /robots.txt {
                    allow all;
                    log_not_found off;
                    access_log off;
            }
    
            # serve static files directly
            location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ {
                access_log        off;
                expires           max;
            }
    
            location /api {
                root /var/www/geometrystash.com/htdocs;
                index index.php;
    
                location ~ \.php$ {
                    try_files $uri $uri/ /index.php?$args;
                    fastcgi_pass unix:/var/run/php5-fpm/geometrystash.com.socket;
                    fastcgi_index index.php;
                    include /etc/nginx/fastcgi_params;
                    }
            }
    
            location ~ \.php$ {
    		try_files $uri $uri/ /index.php?$args;
                    fastcgi_pass unix:/var/run/php5-fpm/geometrystash.com.socket;
                    fastcgi_index index.php;
                    include /etc/nginx/fastcgi_params;
            }
    }

    Thread Starter ansonl

    (@ansonl)

    Site domain is geometrystash.com. Nginx server conf file for this site posted below.

    server {
        server_name  www.geometrystash.com;
        rewrite ^(.*) http://geometrystash.com$1 permanent;
    }
    
    server {
            listen 80;
            server_name geometrystash.com;
            root /var/www/geometrystash.com/htdocs/blog;
                    index index.php;
    		include /etc/nginx/security;
    
    # Logging --
    access_log  off;
    error_log  /var/log/nginx/geometrystash.com.error.log warn;
    
            location = /favicon.ico {
                    log_not_found off;
                    access_log off;
            }
    
            location = /robots.txt {
                    allow all;
                    log_not_found off;
                    access_log off;
            }
    
            # serve static files directly
            location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ {
                access_log        off;
                expires           max;
            }
    
            location /api {
                    try_files $uri $uri/ /index.php?$args;
    		root /var/www/geometrystash.com/htdocs;
            	index index.php;
    	}
    
            location ~ \.php$ {
    		try_files $uri $uri/ /index.php?$args;
                    fastcgi_pass unix:/var/run/php5-fpm/geometrystash.com.socket;
                    fastcgi_index index.php;
                    include /etc/nginx/fastcgi_params;
            }
    }
Viewing 4 replies - 1 through 4 (of 4 total)