1

Topic: 0.9.9 nginx only works for iRedAdmin ? (no virtual domain support?)

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release):  0.9.9
- Deployed with iRedMail Easy or the downloadable installer?  Downloadable Installer
- Linux/BSD distribution name and version:  Ubuntu 16.04.6 LTS
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):  MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

This is a new install on a fresh setup of Ubuntu 16.04.6 LTS. It was the first thing installed after the
new system was up and running. We want to use the nginx server to host our domain but it appears
it isn't as simple as copying an existing conf from a working server to the new box.

On moving an working/existing nginx site configuration into the sites-available directory and creating a
symlink in the enabled directory and performing the reload, the site fails to function properly. This is a
simple site ( html and static images ) which worked fine on a fresh install of nginx. 
Nginx will
serve the site but not the images or javascript files in subdirectories under the root. All permissions are
r-r-r.  Index.html references "images/banner.jpg" but it does not get displayed, however
http://example.com/images/banner.jpg renders fine.


This is as plain as it gets, I have substituted the name "example" for the actual domain used.

server {

    listen         80;
    listen         [::]:80;
    server_name    example.com www.example.com;
    root           /var/www/example.com;
    index          index.html;

    access_log /var/log/nginx/example_access.log;
    error_log  /var/log/nginx/example_error.log;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ /\.ht {
       deny  all;
    }
}

The same conf file and html tree render and work as expected on our other server.

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: 0.9.9 nginx only works for iRedAdmin ? (no virtual domain support?)

tbalon wrote:

Nginx will serve the site but not the images or javascript files in subdirectories under the root.

I think your Nginx config file has some issue to handle the images/js files, i suggest double check Nginx error message, and compare the Nginx config.

3

Re: 0.9.9 nginx only works for iRedAdmin ? (no virtual domain support?)

I've had similar experience. The problem was caused by "Content-Security-Policy" header in /etc/nginx/conf-enabled/headers.conf:

add_header Content-Security-Policy "default-src https: data: 'unsafe-inline' 'unsafe-eval'";

I added 'self' policy to this header and it helped:

add_header Content-Security-Policy "default-src https: data: 'unsafe-inline' 'unsafe-eval' 'self'";