enabling https on BookStack v0.19.0 #579

Closed
opened 2026-02-04 21:16:38 +03:00 by OVERLORD · 6 comments
Owner

Originally created by @sumptuoust on GitHub (Feb 27, 2018).

Have registered an SSL certificate for bookStack v0.19.0 running in my organisation when I change the nginx.config as from my ssl cert provider but after that BookStack v0.19.0 wont run.

Originally created by @sumptuoust on GitHub (Feb 27, 2018). Have registered an SSL certificate for bookStack v0.19.0 running in my organisation when I change the nginx.config as from my ssl cert provider but after that BookStack v0.19.0 wont run.
OVERLORD added the 🐕 Support label 2026-02-04 21:16:38 +03:00
Author
Owner

@Shackelford-Arden commented on GitHub (Feb 27, 2018):

Could you provide more information such as your nginx.conf along with any errors that you see?

@Shackelford-Arden commented on GitHub (Feb 27, 2018): Could you provide more information such as your nginx.conf along with any errors that you see?
Author
Owner

@sumptuoust commented on GitHub (Feb 28, 2018):

nginx.conf.txt
error nginx
See attached config and the screenshot of the error message

@sumptuoust commented on GitHub (Feb 28, 2018): [nginx.conf.txt](https://github.com/BookStackApp/BookStack/files/1765658/nginx.conf.txt) ![error nginx](https://user-images.githubusercontent.com/36879732/36770848-88807ed6-1c55-11e8-882e-fe308462872f.jpg) See attached config and the screenshot of the error message
Author
Owner

@lommes commented on GitHub (Feb 28, 2018):

Since I'm not familiar with nginx I'm just curious.

Do the directives es and esuser exist?

@lommes commented on GitHub (Feb 28, 2018): Since I'm not familiar with nginx I'm just curious. Do the directives es and esuser exist?
Author
Owner

@domainzero commented on GitHub (Mar 7, 2018):

@sumptuoust
Your config is pretty hosed. I straightened out your nginx.conf below.

user www-data;
worker_processes auto;
pid /run/nginx.pid;

events {
	worker_connections 768;
	# multi_accept on;
}

http {
	sendfile on;
	tcp_nopush on;
	tcp_nodelay on;
	keepalive_timeout 65;
	types_hash_max_size 2048;
	include /etc/nginx/mime.types;
	default_type application/octet-stream;
	ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
	ssl_prefer_server_ciphers on;

	access_log /var/log/nginx/access.log;
	error_log /var/log/nginx/error.log;

	gzip on;
	gzip_disable "msie6";

	include /etc/nginx/conf.d/*.conf;
	include /etc/nginx/sites-enabled/*;
}

There are a few ways to create virtual hosts in nginx - I'm going to detail the method I prefer.
Create a new file in /etc/nginx/sites-available - create the directory if it doesn't exist. This file is going to define the BookStack virtual host. Drop something like the below in - subbing in your own paths and names.

# redirect all http requests to https
server {
        listen 80;
        server_name <your_server_name or default>;
        return  301 https://$server_name$request_uri;
}

server {
        listen 443 ssl;
        server_name <your_server_name or default>;
        ssl_certificate    /etc/nginx/CA.crt;
        ssl_certificate_key    /etc/nginx/km.ananda.com.mm.key;
        ssl_stapling on;
        ssl_stapling_verify on;
        ssl_protocols TLSv1.1 TLSv1.2;
        add_header Strict-Transport-Security "max-age=31536000";

        root /path/to/bookstack/install/public;
        index index.php;
        gzip on;
        # pass php requests to php handler
        location ~ \.php {
                fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }
        location / {
                try_files $uri $uri/ /index.php?$query_string;
        }
}

Finally, create a symbolic link from /etc/nginx/sites-available/site to /etc/nginx/sites-enabled/site and reload/restart nginx.

@domainzero commented on GitHub (Mar 7, 2018): @sumptuoust Your config is pretty hosed. I straightened out your `nginx.conf` below. ```nginx user www-data; worker_processes auto; pid /run/nginx.pid; events { worker_connections 768; # multi_accept on; } http { sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE ssl_prefer_server_ciphers on; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; gzip on; gzip_disable "msie6"; include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; } ``` There are a few ways to create virtual hosts in nginx - I'm going to detail the method _I prefer_. Create a new file in `/etc/nginx/sites-available` - create the directory if it doesn't exist. This file is going to define the BookStack virtual host. Drop something like the below in - subbing in your own paths and names. ```nginx # redirect all http requests to https server { listen 80; server_name <your_server_name or default>; return 301 https://$server_name$request_uri; } server { listen 443 ssl; server_name <your_server_name or default>; ssl_certificate /etc/nginx/CA.crt; ssl_certificate_key /etc/nginx/km.ananda.com.mm.key; ssl_stapling on; ssl_stapling_verify on; ssl_protocols TLSv1.1 TLSv1.2; add_header Strict-Transport-Security "max-age=31536000"; root /path/to/bookstack/install/public; index index.php; gzip on; # pass php requests to php handler location ~ \.php { fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } location / { try_files $uri $uri/ /index.php?$query_string; } } ``` Finally, create a symbolic link from `/etc/nginx/sites-available/site` to `/etc/nginx/sites-enabled/site` and reload/restart nginx.
Author
Owner

@lommes commented on GitHub (Mar 13, 2018):

@ssddanbrown I think this can be closed. It seems like the problem were non-existing directives in nginx config.

@lommes commented on GitHub (Mar 13, 2018): @ssddanbrown I think this can be closed. It seems like the problem were non-existing directives in nginx config.
Author
Owner

@ssddanbrown commented on GitHub (Mar 18, 2018):

Thanks for letting me know @lommes

@ssddanbrown commented on GitHub (Mar 18, 2018): Thanks for letting me know @lommes
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#579