Skip to content

Instantly share code, notes, and snippets.

@he426100
Forked from mjau-mjau/nginx.conf
Created January 8, 2020 12:52
Show Gist options
  • Select an option

  • Save he426100/47f623c58b17c1bd55bbfdd6468f106f to your computer and use it in GitHub Desktop.

Select an option

Save he426100/47f623c58b17c1bd55bbfdd6468f106f to your computer and use it in GitHub Desktop.
X3 NGINX config
server {
# Basic NGINX site setup
listen 80;
server_name yourwebsite.com;
# Location where X3 is installed
root /var/www/yourwebsite;
# index.php as index
index index.php;
# X3 rewrite rules
location / {
if (!-e $request_filename){
# Rewrite any calls to html|json|xml|atom|rss if a folder matching * exists
rewrite (.+)\.(html|json|xml|atom|rss)$ $1/ last;
# Rewrite any calls to /render to the X3 image resizer
rewrite ^/render/. /app/parsers/slir/ last;
# Rewrite routes to X3 application index.php if they are non-existent files/dirs
rewrite ^(.*)$ /index.php?$1 last;
}
}
# Prevent web access to X3 /config and /_cache directories
location ~ /(config|_cache) {
deny all;
}
# PHP [OPTIONAL]
# PHP setup may vary, but you should already have PHP working for NGINX or for a website.
# Likely you may have a php.conf file to include.
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# With php5-cgi alone:
fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
# fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment