[plug] Help with nginx configuration file

Chris Caston chris at caston.id.au
Sat Aug 22 16:06:08 AWST 2020


Hi everyone,

I have installed Ubuntu 20.04 with openldap, nginx and phpLDAPadmin with
SSL and basic http auth. This part is working fine but next I want to
install gitlab.

It errors out with:

```
There was an error running gitlab-ctl reconfigure:

letsencrypt_certificate[gitlab.themarketplace.space]
``` *snipped*

I'm a bit uncertain as to how my nginx configuration should be set.

```
sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful``````
certbot --nginx -d gitlab.themarketplace.space

IMPORTANT NOTES:
 - Unable to install the certificate
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/gitlab.themarketplace.space/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/gitlab.themarketplace.space/privkey.pem
   Your cert will expire on 2020-11-20. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
```
I assume that I need to get that working for gitlab will install.



```
cat /etc/nginx/sites-available/default
server {
server_name ldap.themarketplace.space;

# document root
root /var/www/html;
index index.php index.html index.htm;

# application: phpldapadmin
location /phpldapadmin {
auth_basic "Please authenticate:";
auth_basic_user_file /etc/apache2/htpasswd;
alias /usr/share/phpldapadmin/htdocs;
index index.php index.html index.htm;
}




location ~ ^/phpldapadmin/.*\.php$ {
root /usr/share;
if ($request_filename !~* htdocs) {
rewrite ^/phpldapadmin(/.*)?$ /phpldapadmin/htdocs$1;
}
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;
}

# logging
error_log /var/log/nginx/phpldapadmin.error.log;
access_log /var/log/nginx/phpldapadmin.access.log;

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/
ldap.themarketplace.space/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/
ldap.themarketplace.space/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
server {
    if ($host = ldap.themarketplace.space) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


server_name ldap.themarketplace.space;
listen 80;
    return 404; # managed by Certbot

}```
I have four A resource records:
```
themarketplace.space A 139.180.171.63
gitlab.themarketplace.space A 139.180.171.63
ldap.themarketplace.space A 139.180.171.63
www.themarketplace.space A 139.180.171.63
```
So I'm not sure if my /etc/nginx/sites-available/default should have
multiple server blocks each with it's own server_name and exactly what
format it needs to be in for gitlab to work.

Any help would be much appreciated.

Thank you.

Chris Caston
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.plug.org.au/pipermail/plug/attachments/20200822/77e5b320/attachment.html>


More information about the plug mailing list