Nginx with uwsgi - nginx

I am using nginx with uwsgi.
I want to serve an html page but with an image attached to it dynamically. So the page will have some contents (generated dynamically) and the image at the top.
Please let me know how can I do it.
I am able to serve the page with contents alone.
Note: I am not using anything else (like Flask, Django etc.).
Thanks a lot.

Related

NGINX fails to rewrite the html

I try to set up two different services under the same NGINX in this way:
When I hit /discovery/ from the browser, I see the result HTML page but the browser cannot load some resources that are in another directory:
So the browser request for /eureka/css/wro.css instead of /discovery/eureka/css/wro.css because, seems that NGINX does not translate properly the URLs in the HTML page.
In the source HTML, everything seems correct:
Is there any specific configuration that I miss in NGINX?

browser-sync not working with single page application

I have a single page application that does not use hash URLs I want to use the history API. I am using the middleware historyApiFallback() in browserSync server options. However, this is only working for one level deep URLs:
http://localhost:3000/main correctly resolves to index.html
BUT
http://localhost:3000/main/a is NOT working. The browser shows "connected to browser sync" and then a blank page is displayed.
Anyone knows what could be the issue here?
The issue was that the URLs for js and css resources weren't correctly setup. This post helped me fixed the issue: mod_rewrite to index.html breaks relative paths for deep URLs

FlowRouter locally served images break after redirect

While using FlowRouter if I load my page any locally served images (images/myImage.png) works fine. But if I navigate to a page and then navigate back (home page -> about page -> home page) the image is broken. However in the developer console, if I hover over the image source, the image appears fine.
This is not an issue with images served from another server.
Update
I never solved this issue, but because this still seems to be an issue with many people. I'm posting my work around. Based on the Meteor communities advice, I switched to cloud based image hosting like Cloudinary or AWS
It sounds like you are sometimes accessing images using their file paths. With Meteor, to serve static files properly, they need to be in the /public folder of your project. So you should put them in /public/images, and then reference them according to the following example:
The file
/public/images/foo.png
is displayed by
<img src="/images/foo.png>
See here: https://guide.meteor.com/structure.html#special-directories
I realized that although my images worked with the following:
Image is in /public/images/name.png
<img src="images/name.png">
But then I changed the url to:
<img src="/images/name.png">
Now it works and doesn't break.

Serve images from an alternate location without exposing the location using url re-write

On my asp.net site running in IIS7 I want any images, css and scripts (\.js|\.css|\.jpg|\.png|\.gif)$ on the HOME page to be loaded from a sub-domain, but for reasons I won’t go into I want them to appear to come from the original source location.
For example an image on the home page with a source of
http(s)://www.mysite.com/some-directory/image.gif
should actually be served from
http(s)://hidden.mysite.com/some-directory/image.gif
but as far as the requesting browser is concerned it should appear to come from the original source location.
Any scripts coming from googleapis.xxx should be excluded, as should any images from /images(.*)
Can this be achieved with url rewrite rules, if so how?

Nginx and Watermarking

I use ngx_http_image_filter_module module for serving images in my project.
Everything works perfectly. And now I want to dynamically put watermarks on images.
I can't put them on upload because image sizes are often being changed.
So, is that possible with nginx?
Try this patch. I found it through internet.
It is allow to nginx to apply watermark's. This implementation only works with using function, which change size of image.

Resources