-
Notifications
You must be signed in to change notification settings - Fork 194
Nginx Configuration
twistedR edited this page Dec 2, 2014
·
2 revisions
If you are planning to run Unmark on a machine with Nginx as the web server you can use the following virtual host configuration file. There are two. The first one is a regular one for http. The second one is if you wish to run Unmark with HTTPS support.
These instructions are for Ubuntu/Debian.
Just place the appropriate file under /etc/nginx/sites-avaiable
and then symlink to /etc/nginx/sites-enabled
Then all you need to do is sudo service nginx reload
server {
listen *:80;
server_name your.server.name;
root /path/to/unmark/files/;
index index.php index.html index.html;
rewrite ^system.* /index.php?/$1 break;
rewrite ^application.* /index.php?/$1 break;
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?/$1 break;
}
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
try_files $uri = 404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include /etc/nginx/fastcgi_params;
fastcgi_index index.php;
}
}
server {
listen *:80;
server_name your.server.name;
rewrite ^ https://$server_name$request_uri? permanent;
}
server {
listen *:443 ssl;
server_name your.server.name;
charset utf-8;
ssl on;
ssl_certificate /path/to/certificate/file.crt;
ssl_certificate_key /path/to/key/file.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS;
ssl_prefer_server_ciphers on;
root /path/to/unmark/files/;
index index.php index.html index.html;
rewrite ^system.* /index.php?/$1 break;
rewrite ^application.* /index.php?/$1 break;
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?/$1 break;
}
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
try_files $uri = 404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include /etc/nginx/fastcgi_params;
fastcgi_index index.php;
}
}