NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

I worked through the excellent guide on installing a tile server in Ubuntu 18.04. Frankly, this is one of the best guides I’ve ever used, and I’ve slogged through quite a few over the years.

I ran into a couple of block walls at the end though. First, I want to say everything installed without any noted errors. I did get a ton of warnings (like this: Warning: amenity-points.mss:2468:6 Styles do not match layer selector .text-low-zoom.) when running carto, but that seems to be about all.

I installed the Switcheroo Redirector extension in Chrome and pointed things towards my public ip address, but I keep getting Content Security Policy notices:

Refused to load the image '<URL>' because it violates the following Content Security Policy directive: "img-src 'self' data: <URL> * * * *”.

Initially I thought this issue was related to my server (I’m no expert on CSP!) so I added mod_headers and added very permissive policy directives. Chrome continued to refuse to load the Humanitarian Layer, but it does load the other three layers. I’ve since concluded the CPS notifications were coming from OpenStreetMap instead.

I also threw together some html/css/javascript and used Leaflet to display a page. I did this with MapBox and it worked, so I’m confident my test code is acceptable. But, when I try to point towards my own server (same platform at this point), all I can get is a blank screen showing the map canvas without any graphics:

alt text

This occurs in both Chrome and Safari; neither browser reports any errors, all statuses are 200.

Syslog during an Apache start: May 24 07:59:58 ubuntu systemd1: Starting The Apache HTTP Server... May 24 07:59:58 ubuntu apachectl[95797]: [Thu May 24 07:59:58.490304 2018] [tile:notice] [pid 95800:tid 140608967183296] Loading tile config ajt at /hot/ for zooms 0 - 20 from tile directory /var/lib/mod_tile with extension .png and mime type image/png May 24 07:59:58 ubuntu systemd1: Started The Apache HTTP Server.

Contents of /var/lib/mod_tile/ajt:

alt text

I’m not sure how many of these directories should be here? I do want to say that when I try to use this link in Chrome w/ the extension, and I get the CSP notifications, if I click on one of the PNGs shown in the notification, I will get a tile to load and display. And, an additional folder gets created under /var/lib/mod_tile/ajt. I assume from this that my actual renderer works?

Does this mean my problem is in how my Apache server is handing off the work to the tile server? Is my mod_tile broken?

Here is my output from http://ipaddress/mod_tile after loading two png files using the method I described two paragraphs above.

NoResp200: 2
NoResp304: 0
NoResp404: 0
NoResp503: 0
NoResp5XX: 0
NoRespOther: 0
NoFreshCache: 1
NoOldCache: 0
NoVeryOldCache: 0
NoFreshRender: 1
NoOldRender: 0
NoVeryOldRender: 0
NoRespZoom00: 0
NoRespZoom01: 0
NoRespZoom02: 0
NoRespZoom03: 0
NoRespZoom04: 0
NoRespZoom05: 0
NoRespZoom06: 0
NoRespZoom07: 0
NoRespZoom08: 0
NoRespZoom09: 0
NoRespZoom10: 0
NoRespZoom11: 0
NoRespZoom12: 0
NoRespZoom13: 0
NoRespZoom14: 2
NoRespZoom15: 0
NoRespZoom16: 0
NoRespZoom17: 0
NoRespZoom18: 0
NoRespZoom19: 0
NoRespZoom20: 0
NoTileBufferReads: 2
DurationTileBufferReads: 126
NoTileBufferReadZoom00: 0
DurationTileBufferReadZoom00: 0
NoTileBufferReadZoom01: 0
DurationTileBufferReadZoom01: 0
NoTileBufferReadZoom02: 0
DurationTileBufferReadZoom02: 0
NoTileBufferReadZoom03: 0
DurationTileBufferReadZoom03: 0
NoTileBufferReadZoom04: 0
DurationTileBufferReadZoom04: 0
NoTileBufferReadZoom05: 0
DurationTileBufferReadZoom05: 0
NoTileBufferReadZoom06: 0
DurationTileBufferReadZoom06: 0
NoTileBufferReadZoom07: 0
DurationTileBufferReadZoom07: 0
NoTileBufferReadZoom08: 0
DurationTileBufferReadZoom08: 0
NoTileBufferReadZoom09: 0
DurationTileBufferReadZoom09: 0
NoTileBufferReadZoom10: 0
DurationTileBufferReadZoom10: 0
NoTileBufferReadZoom11: 0
DurationTileBufferReadZoom11: 0
NoTileBufferReadZoom12: 0
DurationTileBufferReadZoom12: 0
NoTileBufferReadZoom13: 0
DurationTileBufferReadZoom13: 0
NoTileBufferReadZoom14: 2
DurationTileBufferReadZoom14: 126
NoTileBufferReadZoom15: 0
DurationTileBufferReadZoom15: 0
NoTileBufferReadZoom16: 0
DurationTileBufferReadZoom16: 0
NoTileBufferReadZoom17: 0
DurationTileBufferReadZoom17: 0
NoTileBufferReadZoom18: 0
DurationTileBufferReadZoom18: 0
NoTileBufferReadZoom19: 0
DurationTileBufferReadZoom19: 0
NoTileBufferReadZoom20: 0
DurationTileBufferReadZoom20: 0
NoRes200Layer/hot/: 2
NoRes404Layer/hot/: 0

I’m concluding from this that my web server is not handing off to mod_tile, but I don’t know why, nor am I sure what troubleshooting step I can take next.

Any help would be greatly appreciated! I hope to hear back from you soon. In the meantime, I’ll start trying to look closer at mod_tile, and running renderd with more logging.


I installed and configure munin to provide stats. I'm getting nothing from renderd:

alt text

asked 24 May '18, 17:44

tim_rohrer's gravatar image

accept rate: 100%

edited 24 May '18, 19:50

I've added an answer at - based largely on what you have found out!

In your case the fact that tiles are getting generated (as the "ls -al" shows) means that the link to mod_tile is working, but as you've since found the CSP (I think) is stopping Chromium from serving tiles.

(24 May '18, 18:42) SomeoneElse ♦

Unfortunately, when I created my own leaflet-based site, and tested against my local server, I still only get the blank screen shown above.

In my server, CSP is not active. No errors or issues are noted in the browser.

I'm still working to pore through more logs, but not getting much to speak of.

(24 May '18, 19:02) tim_rohrer

Does your leaflet-based site work with osm's tile servers?

(24 May '18, 20:47) SomeoneElse ♦

I tested against MapBox, yes I'm confident my code is acceptable. Do you think there is something different that should cause me to try and point towards osm's tile servers directly?

I'm in the process of redownloading shape files since, well, I don't know what else to try.

(24 May '18, 20:54) tim_rohrer

I still have not gotten this figured out, and mucking with the shape files made things worse. I've started over, and we'll see how it goes.

I'm still curious about the warnings I get with carto, although I've been told those shouldn't be a factor.

On a related note, what are the roles of the .lua and .style files used in the osm2pgsql process? Do they contain data that is actually imported into the gis database? Ultimately, if there is a problem with the openstreetmap-carto configuration, does that mean the database needs to be regenerated?

Any known tests for this?

(25 May '18, 19:07) tim_rohrer

The .style file (such as this one) determines what database columns are created, and the .lua file (such as here) allows fine-grained control over data as it is imported.

I've you've been using the lua transforms to move OSM data into a different column then yes, you might need to reload data after changing a .lua file. If you've not changed that you won't need to, though.

The bit of the switch2osm guide that says "Point a web browser at: http://yourserveripaddress/hot/0/0/0.png" is the basic test to check that your tile server's working.

Another thing that you might try is (on one session) "sudo tail -f /var/log/syslog" and on another "sudo /etc/init.d/renderd restart"

(25 May '18, 21:34) SomeoneElse ♦

Thanks @SomeoneElse. I just set up another server and ran through the setup process. Basically the same, although I created a different user.

I am able to display the /hot/0/0/0.png, so I'm glad to hear your comment there.

Maybe I need to start a new question and post some code, but I've run my JS against MapBox and it works. So, that leads me to think my URL template is wrong/misunderstood? The forms I've tried that don't produce errors include: http://<internalip>/#map=13/40.3743/49.7134 and http://<internalip>#map=13/40.373/49.7134.

To confirm, I should be able to files served up to the user on the node as the tile server, correct?

(26 May '18, 02:18) tim_rohrer
showing 5 of 7 show 2 more comments

I am happy to report I figured it out. As @SomeoneElse pointed out, the successful loading of 0/0/0.png is a good indication that the tile server is working. This caused me to return to look closer at the leaflet.js code I had cobbled together. In hindsight, I think I should have caught this earlier.

The URL Template is where I found my error. Although I didn't see this in the leaflet.js documentation, the lat, lng, and zoom values are automatically picked up from the setView function of, and are not explicitly stated in L.tileLayer. In fact, L.tileLayer is (as it does say in the documentation) a template; it turns out it is one that automatically (if you will) populates.

Perhaps this will be of help to someone in the future.

permanent link

answered 26 May '18, 05:07

tim_rohrer's gravatar image

accept rate: 100%

So what should I do to correct this? I'm having the same issues but didn't understood how to solve it.

(16 Nov '19, 19:40) carlosguedes

Hi Carlos, do you have a public link to your setup to inspect you leaflet code? That would be the easiest way to help you out. Otherwise (if it's small) just post your leaflet code here or at paste bin or somewhere were we can have a look.

(16 Nov '19, 20:40) Spiekerooger

The Leaflet file is the raw one used by the tutorial

I just posted my question in another topic to don't make a mess

(17 Nov '19, 02:04) carlosguedes

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 24 May '18, 17:44

question was seen: 8,172 times

last updated: 17 Nov '19, 02:06

NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum