-
-
Notifications
You must be signed in to change notification settings - Fork 165
NGINX server config
Paste the below code into your NGINX server config file /etc/nginx/nginx.conf
or the config file in /etc/nginx/site-available/wondercms.conf
(and enable it with a symlink in the site-enabled
folder).
Replace the server_name
with your actual domain and the root
path with your actual path where WonderCMS is installed.
server {
listen 80;
# adapt to your server name
server_name www.wonder-example.com;
# adapt the path
root /var/www/wondercms;
index index.php;
# prevent directory listing
autoindex off;
# rewrite url to make it pretty
location / {
try_files $uri $uri/ @rewrite;
}
location @rewrite {
rewrite ^/(.+)$ /index.php?page=$1 last;
}
# prevent access to database.js
location ~ database.js {
return 403;
}
location ~ cache.json {
return 403;
}
# use php-fpm for dealing with php files
location ~ \.php(/|$) {
# this could also be called fastcgi_params depending on your distribution
include fastcgi.conf;
# using unix socket
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
# uncomment (and comment the one above) if you are using the TCP port 9000 for php-fpm
# fastcgi_pass 127.0.0.1:9000;
}
}
The code above replicates Apache's htaccess functionality with the power of your NGINX server config. Since NGINX doesn't have the "traditional" htaccess file, this is necessary to make WonderCMS work properly.
NOTE: The code above is required to deny access to database.js, cache.json and make clean URL's which are SEO friendly.
Thanks for @NicolasCARPi for providing a neat solution!
Still need help?
- Ask a question or make a request in the community.
- Official website
Intro
- Home
- Demo
- Download
- One step install
- Requirements
- 5 file structure
- List of hooks
- Included libraries
- Create theme in 8 easy steps
- Create a plugin
- Custom modules
- Translations
- All security features described
Basic how to's
- Backup all files
- Change default login URL
- Change default password
- Create custom page template
- Create new editable areas or editable blocks
- Edit 404 page
- Get data from database
- Set data to database
- Hide page from menu
- Caddy web server config
- IIS server config
- NGINX server config
- Login
- Recover login URL
- Reset password
- Restore backup
- Update
- PHP built in server
Themes
- Create theme in 8 easy steps
- Add favicon
- Theme tags
- Update theme to work with WonderCMS 2.0.0
- Update theme to work with WonderCMS 3.0.0
- Share your themes with Custom modules
Plugins
- Quick intro on creating plugins and List of hooks
- Share your plugin with simply with Custom modules
Security
- All security features described
- Add SRI tags to your theme libraries
- Always redirect to https and www
- Additional security configuration(s)
- Add SRI tags to your theme libraries
- Better security mode (HTTPS and other features)
Features description
- One click update
- Optional: functions.php file
- Default database.js
- Allowed extensions file types for uploads
- Login URL doesn't work - 404
- 500 internal server error
- Persistent "New WonderCMS update available" message
- URLs mailformed on Windows IIS
- Other errors