Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
NGINX server directives in 4.7.0-dev
For reasons that I’m not entirely sure of, I’m getting my teeth into NGINX as an alternative to Apache httpd. On reflection, I really like how straightforward it is in some respects, and I’m totally baffled in others.
Question: what server
or location
directive is needed to handle Textpattern section article lists in clean URL mode?
Background: almost everything works, apart from non-default article lists in non-messy mode. For example:
https://example.com/index.php?s=articles
OK (200)https://example.com/articles
Not Found (404 by Textpattern, not NGINX)https://example.com/article-title
OK (200)https://example.com/articles/article-title
OK (200)
Here’re my (anonymised) server
and location
directives:
server {#IPv4 and IPv6 hostname, https, PHP fastcgi
server_name www.example.com example.com;
listen 443 http2 ssl;
listen [::]:443 http2 ssl;
ssl_certificate /etc/letsencrypt/live/www.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.example.com/privkey.pem;
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /etc/letsencrypt/live/www.example.com/fullchain.pem;
add_header Strict-Transport-Security "max-age=31536000;" always;
charset utf-8;
root /var/www/vhosts/example.com/www/live;
index index.html index.php;
access_log /var/log/nginx/www.example.com.access.log;
error_log /var/log/nginx/www.example.com.error.log;
location / {
try_files $uri $uri/ /index.php?$args;
}
location = /favicon.ico {
log_not_found off;
}
location ~ /\. {
deny all;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
(Aside: that Prism formatting is nice, Phil!)
And my diagnostics (private info hidden):
Textpattern version: 4.7.0-dev (d8f5fc157caa25b6d9ce30fc40a2649e)
Last update: 2018-01-19 15:09:10/2018-01-19 15:02:50
Article URL pattern: title_only
Temporary directory path: /tmp
PHP version: 7.0.22-0ubuntu0.16.04.1
GD Graphics Library: unavailable
Server TZ: UTC
Server local time: 2018-01-19 15:54:02
Daylight Saving Time enabled?: 0
Automatically adjust Daylight Saving Time setting?: 1
Time zone (GMT offset in seconds): Europe/London (0)
MySQL: 5.6.22-71.0 (Percona Server (GPL), Release 71.0, Revision 726)
Database server time: 2018-01-19 15:54:02
Database server time offset: 0 s
Database server timezone: SYSTEM
Database session timezone: SYSTEM
Locale: en_GB.UTF-8
Server: nginx/1.10.3
PHP server API: fpm-fcgi
RFC 2616 headers: 0
Server OS: Linux 4.4.0-109-generic
Admin-side theme: hive 4.7.0-dev
Pre-flight check:
------------------------
img_dir is not writable: __TXP-ROOT/images
file_base_path is not writable: __TXP-ROOT/files
skin_dir is not writable: __TXP-ROOT/themes
__TXP-ROOT/textpattern/setup/ still exists.
You are running a development version of Textpattern on a live server.
The following PHP functions (which may be necessary to run Textpattern) are disabled on your server: pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_wifsignaled, pcntl_wifcontinued, pcntl_wexitstatus, pcntl_wtermsig, pcntl_wstopsig, pcntl_signal, pcntl_signal_dispatch, pcntl_get_last_error, pcntl_strerror, pcntl_sigprocmask, pcntl_sigwaitinfo, pcntl_sigtimedwait, pcntl_exec, pcntl_getpriority, pcntl_setpriority,
------------------------
Thanks for your extra eyes and brain on this, any advice/testing ideas are very warmly received.
Last edited by gaekwad (2018-01-19 15:57:52)
Offline
Re: NGINX server directives in 4.7.0-dev
Never used it but can you glean any tips from Drupal’s clean URL implementation ? Not sure if the rewrite directive is necessary.
Failing that, this primer on clean URLs might be of some use. Sorry I can’t be more help.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Online
Re: NGINX server directives in 4.7.0-dev
Cheers, Bloke – I’ll add those to the list of articles on configs I’m cribbing. I think makss is offline for the moment, so I’ll keep poking around.
Offline
Re: NGINX server directives in 4.7.0-dev
Resolved.
It transpires I can’t be trusted with typing the correct things onto the appropriate lines.
Mea culpa.
Offline