node.js – Serving multiple nodejs sites with nginx which ports should I be starting apps on

I have multiple nodejs apps from different domains that I am serving from the same server with nginx. I am currently starting each app on a different port say 5000, 5001, 5002 ect. Then using nginx proxy_pass to serve them from the ssl port 443 like so:

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name mydomain.com;

    ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem;
    ssl_protocols TLSv1.1 TLSv1.2;
    include snippets/ssl-params.conf;

    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-NginX-Proxy true;
        proxy_pass http://localhost:5000/;
        proxy_ssl_session_reuse off;
        proxy_set_header Host $http_host;
        proxy_cache_bypass $http_upgrade;
        proxy_redirect off;
    }
}

And I am setting up a block just like this for each domain/app.

I have a couple questions I guess:

  1. What ports should I be starting the apps on so I can avoid conflicts. Are there standard ports that I should be using?
  2. Is this the way I should be doing this or is there a better way to go about this.

I read that ports above 49151 are for arbitrary uses. Should I be starting my apps in those ports above 49151?

Any guidance would be appreciated here. I am a web developer and don’t have a lot of experience with the server side of things.

design – Serving content to authenticated users

I’m wanting to store lots of data in cloud storage – like S3.

I want some data to only be accessed by authorised users, one way I could do this is to authenticate the user on my service, download the data from the cloud to my server, and serve the data to the user. This seems innefficient – as my server has to both upload/download the content.

I’d rather the user directly download the data from the cloud – is there a standard technique for handling this?


I was hoping maybe there was a way to hook in my Oauth2 provider to my cloud storage so they can easily authenticate downloads – cant find anything like this. Maybe I’ll use short-lived pre-signed URLs, that I’d have to generate for every download

Nginx + Gunicorn + Flask not serving static files

I am new to Nginx and Gunicorn….

I am trying to serve flask app on certain prefix….

ex: https://myweb.com/flask/prefix/

everything works fine except it is not loading static files……

my nginx site configuration looks like below

location /flask/prefix/ {
        include proxy_params;
        proxy_pass http://unix:/home/user/flask_config/flask_socket_file.sock:/;        
    }

when I checked the network section by using Firefox developer tool I found that it is loading home page path / for static files instead of this /flask/prefix….

Example:

/static/image.png (i.e https://myweb.com/static/image.png)

but it suppose to be /flask/prefix/static/image.png (i.e https://myweb.com/flask/prefix/static/image.png).

However I tried to remove :/ at the end of proxy_pass statement… it ended with 501 error….

Please let me know what I am doing wrong….

I followed steps to configure Flask app with Nginx from Here

I am Ads Limit serving since Started Website but Revenue is Generated

Hey Digitalpoints Friends , recently i have Applied for Adsense My Adsense is Approved but Revenue is very low. Even My Website Traffic is High and Backlinks are created Paid Backlinks . But Revenue is very low .. Please Need Your Suggestions and Guidelines. Here is my Website . https://groworganic.com.pk
and here is Screenshots of Earning with CPM etc .
[​IMG]
and i have Ads Limit Serving Since Started Website but Revenue is Generated…

I am Ads Limit serving since Started Website but Revenue is Generated

Trying to investigate a url serving malware, creating domains on the fly

I search google for “honda firmware dump”, and starting on page 2-3, several results start showing for urls which have domain ending in (.it). I want to uncover what kind of malware is getting served if any, or whether its just ad tracking. The fishy thing for me is, that if i visit any of these urls, starting from the google search result link, and a new private browser window, it will redirect to a new domain each visit, and each of these new domains is getting created/registered on the fly in real time, because whois search shows registered date same day as visit (today). For example:
Google search result of:
hXXp://eiag.sciclinelcuore(.)it/ecu-dump-files.html

when clicked from the google search result link:
hXXps://www.google(.)com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwjSyNTq7OPvAhVIZ80KHX6jCDU4ChAWMAV6BAgGEAM&url=http%3A%2F%2Feiag.sciclinelcuore.it%2Fecu-dump-files.html&usg=AOvVaw2AxAsBBEl2cRDpzPY53-Nx

will redirect to a domain that was just registered same day of visit, and append params to the url which send some data, which i am worried could be info on what os/browser to exploit, similar to what nsa is known to do:
hXXps://section72quietspeed(.)live/tnhxiaix/?u=tqck80z&o=zdqr96x&t=trafback&cid=1evqsidf70p70&f=1&sid=t4~p35dtet2005dffg5v3i3bny3&fp=4HY03UMz4xihwwSxgWzHv3%2BFvsCeTeczYyN9Nej1D9 + a bunch more encoded characters

I ran an any.run report on the link, and showed some malicious activity, would be curious to know what it does: https://app.any.run/tasks/4fc79b4d-b3ea-4f81-a096-51864ccff9e3

Virustotal doesnt seem to follow the full redirect sequence but still found some suspicious things: https://www.virustotal.com/gui/url/b084279b1bb7a601fe1db2998d4da142ae92fff7059914868902afed9abcf231/details

A few examples of the domains getting created on the fly, same day of visit:
https://who.is/whois/section72quietspeed.live

https://who.is/whois/type93yardbase.live

https://who.is/whois/cook43burnrain.live

What kind of actor could this be?

nonstandard analysis – Legitimacy of the shadow map serving as a field homomorphism for a specific hyperfinite field formed of a union of hyperfine lattices

I’m hoping to get some comment on the legitimacy of my approach to creating a hyperfinite ring formed of a union of modular groups in order to obtain a field homomorphism from this hyperfinite space to the real numbers. As nonstandard analysis isn’t my area I feel I’m at risk of accidentally making mortal error and so I’m looking for constructive advice regarding the legitimacy of my approach.

As I said I’m looking to construct a hyperfinite space that can serve as an approximation for the reals as a field in the sense that the shadow (standard) map serves a field homomorphism between this space and $mathbb{R}$. As motivation for how I’ve tried to go about this consider taking the following set

$$
{ }^{star} mathbb{Z}_{omega}:=left{k in{ }^{star} mathbb{Z} mid-leftlceil frac{omega-1}{2} leq k leqleftlfloorfrac{omega-1}{2}rightrfloorright}right.
$$

where $omega:=omega_{mathrm{uv}} omega_{mathrm{ir}}$ for some positive $omega_{mathrm{uv}}, omega_{mathrm{ir}} in{ }^{star}mathbb{Z}$ We can define a hyperfinite abelian group with 0 as the unit with the group operation

$$
a+_{omega} b:=left{begin{array}{ll}
a+b & text { if }-leftlceilfrac{omega-1}{2}rightrceil leq a+b leqleftlfloorfrac{omega-1}{2}rightrfloor \
a+b-omega & text { if }leftlfloorfrac{omega-1}{2}rightrfloor<a+b \
a+b+omega & text { if } a+b<-leftlceilfrac{omega-1}{2}rightrceil
end{array}right.
$$

We can go further and define a ring via
$$
a cdot_{omega} b:=left{begin{array}{ll}
a cdot b & text { if }-leftlceilfrac{omega-1}{2}rightrceil leq a cdot b leqleftlfloorfrac{omega-1}{2}rightrfloor \
a cdot b-k omega & text { if }leftlfloorfrac{omega-1}{2}rightrfloor+(k-1) omega<a cdot b leqleftlfloorfrac{omega-1}{2}rightrfloor+k omega \
a cdot b+k omega & text { if }-leftlceilfrac{omega-1}{2}rightrceil-k omega leq a cdot b<-leftlceilfrac{omega-1}{2}rightrceil-(k-1) omega
end{array}right.
$$

where the ring $left({ }^{star} mathbb{Z}_{omega},+_{omega}, 0, cdot omega, 1right)$ is a field if $omega$ is prime.

Now consider the ‘scaled’ version of this structure
$$frac{1}{omega_{mathrm{uv}}} star mathbb{Z}_{omega}=left{frac{k}{omega_{mathrm{uv}}} mid k in star mathbb{Z},-left(frac{omega-1}{2}rightrceil leq k leqleftlfloorfrac{omega-1}{2}rightrfloorright}$$

Now we take the shadow of this

$$
operatorname{shd}left(left(frac{1}{omega_{mathrm{uv}}}^{star} mathbb{Z}_{omega}right)_{mathrm{fin}}right)=left{operatorname{shd}left(frac{k}{omega_{mathrm{uv}}}right) mid k in{mathrm{Z}} text { s.t. }-left(frac{omega-1}{2}right) leq k leq mid frac{omega-1}{2}rightrfloor text { and } frac{k}{omega_{mathrm{uv}}} text { is finite }} subseteq mathbb{R}
$$

Finite elements are closed under the additive group structure of shd $left(left(frac{1}{omega_{mathrm{uv}}} star mathbb{Z}_{omega}right)_{mathrm{fin}}right)$ and taking the standard part is linear with respect to said additive group structure: this means that $left(left(frac{1}{omega_{text {uv }}} star mathbb{Z}_{omega}right)_{text {fin }},+_{omega}, 0right)$ is an abelian group.

Importantly for my purposes if I choose $omega_{mathrm{uv}}$ and $omega_{mathrm{ir}}$ to be ‘infinite’ then I believe I get the following

$$text { shd }:left(left(frac{1}{omega_{mathrm{uv}}} star mathbb{Z}_{omega}right)_{text {fin }},+_{omega}, 0right) longrightarrow(mathbb{R},+, 0)$$
as the range of the modulus is now up to an infinite number as is the scaling.

Now this approach will fail for a ring because we will want to write
$$
frac{h}{omega_{mathrm{uv}}} cdot_{omega} frac{k}{omega_{mathrm{uv}}}=frac{h cdot_{omega} k}{omega_{mathrm{uv}}}
$$

but we see that what we have is
$$
frac{h}{omega_{mathrm{uv}}} cdot omega frac{k}{omega_{mathrm{uv}}}=frac{h cdot_{omega} k}{omega_{mathrm{uv}}^{2}}
$$

which isn’t in our space.

My solution is to do the following and it is the legitimacy of this which I would like to get some opinions on.

Consider this union of lattices of the type we just discussed:

$$bigcup_{n in star mathbb{Z}_{kappa}} frac{1}{omega_{mathrm{uv}}^{n}}^{star} Z_{omega omega_{mathrm{uv}}^{n-1}}$$
where $kappa$ is an ‘infinite’ hyperinteger and
$$
left.frac{1}{omega_{mathrm{uv}}^{n}}^{star} mathbb{Z}_{omega}=left{frac{k}{omega_{mathrm{uv}}^{n}}left|k in{star} mathbb{Z},-left(frac{omega omega_{mathrm{uv}}^{n-1}-1}{2}rightrceil leq k leqright| frac{omega omega_{mathrm{uv}}^{n-1}-1}{2}rightrfloorright}$$

Now this union of lattices of greater and lesser fineness means that the multiplication problem described above is dealt with though perhaps at the cost of the curious choice of the following being the case:
$$
acdot_{omega}b = frac{acdot_{omega}b}{omega^{kappa}}
$$

Note how we have division defined here as we can take the usual modular inverse $i n v_{omega_{u v}}(p)$ and for any

$y=frac{q}{omega_{u v}^{n}}$ we will have $tilde{y}=omega_{u v}^{n} cdot_{omega} operatorname{inv}_{omega_{u v}^{n}}(p)$
$$
y tilde{y}=frac{q cdot_{omega} omega_{u v}^{n} cdot_{omega} i n v_{omega_{u v}^{n}}(q)}{omega_{u v}^{n}}=1
$$

Now the meat of my question: Is this a legitimate field homomorphism?
$$
operatorname{shd}:left(left(frac{1}{omega_{mathrm{uv}}} star mathbb{Z}_{omega}right)_{fin},+_{omega}, 0, cdot omega, 1right) longrightarrow(mathbb{R},+, 0, cdot, 1)
$$

where multiplication and addition are defined as specified here.

Serving targeted promo codes in Facebook ads

I am working on a solution which is to service preassigned unique promo codes to customers across multiple channels.

  1. Customer receives an email with a unique promo code, which at the time of send is assigned to his email address
  2. This is stored within our CRM system, and can be provided in a combination of this customer’s hashed email address (HEM).
  3. Same promo code we want to present in a Facebook ad, which is targeted to same individual

I know a list of unique promo codes can be uploaded to Facebook, for use with offer ads, but there is nothing which indicates whether this upload can be pre-mapped to an email address or HEM.

Another solution, which I consider pursuing, is to allow the ad to make use of a dynamic feed which would take a unique identifier (HEM?) as a parameter, and return the assigned promo code, which the ad would parse and present. However so far I have only been able to identify product feed as the only option of serving feed based dynamic content to FB ads.

Any advice will be much appreciated.
Thank you

Best regards

Lukas

Google AdSense Ad Serving Has Been Limited

I’ve been a Google AdSense customer for 5 years now. My site is https://wranglertjforum.com. It generates around 1.5 million page views per month and 231,000,000 ad impressions per month.

I’ve never had a problem with serving ads until the past several months. My AdSense account has now started limiting ads and showing me the following message:

Ad serving on your account is currently being limited due to invalid traffic concerns. We’ll automatically review and update this limit as we continue to monitor your traffic. Learn more about ad serving limits.

What you can do
Make sure you understand your ad traffic and site visitors. Never click on your own ads, and avoid partnering with untrusted or low-quality parties. Learn more about preventing invalid traffic. While this ad serving limit typically impacts publishers for less than 30 days, it may take longer in some cases.

Now I’ve looked into this high and low and I honestly can’t figure it out. 98% of my traffic comes from the U.S. as evidenced by my Google Analytics account, and there is absolutely nothing nefarious whatsoever going on. I’ve also made sure that ads are not showing in places where they can accidentally be clicked very easily, and on pages such as the registration page, login page, etc. Near as I can tell they are limiting ad serving based on nothing.

I waited it out (14 days) and then the error message went away, then ad serving came back 100%. Within 2 more weeks the error message was back and they are now limiting ad serving again.

It appears this is some sort of yo-yo thing going on and unfortunately it’s impossible to get ahold of Google.
SEMrush

I’m hoping someone might be able to tell me what I might be missing or what worked for them? This keeps happening and it’s very annoying.

 

web applications – Serving large file (dozens of GB) to client from a server-side query to the Azure SQL database?

I have an SQL database in Azure that is ~4.5 TB / 150 million rows worth of data. Users will need to query this database for large sets of data. Right now, I am having users submit their requests through a web application hosted on an Azure VM.

How can I serve the rows pulled from the Azure SQL database directly to the user? It seems slow for the server to have to stream the data from Azure SQL, and then for the client to have to stream that from the VM.

I wish the user could directly query the Azure SQL db from the client side, but the problem is that the user’s request has to be preprocessed and manipulated against a reference set of over a gigabyte of data; the request to the SQL db needs to happen server-side. Any help appreciated!

php fpm – Serving front and back end (php-fpm) separately in Laravel app with nginx

Here’s my nginx’s default.conf:

server {
    listen 80;
    root /app/public;
    
    # Frontend
    location / {
        proxy_pass http://client;
    }

    # Backend
    location /api {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ .php$ {
        fastcgi_pass api:9000;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

Essentially just a reference to the official nginx suggestion at https://laravel.com/docs/8.x/deployment, except that the frontend is separate and the backend routes should be prefixed with /api. So, for example, /api/users will be matched with to the second location block, nginx will use index.php (because all Laravel functionality goes through that file), and then it will do an internal route check and end up in the third location block which will forward to the php-fpm container.

I’ve got it working, except that I don’t know how to lock down the last location block to only /api-prefixed routes. I’ve tried:

location ~ /api/.*.php {

but that breaks my routes. I’ve tried the above with:

try_files $uri $uri/ /api/index.php?$query_string;

but now I’m referencing an index.php that doesn’t exist on the php container.

Finally, I’ve tried:

 location /api {
    try_files $uri $uri/ /index.php?$query_string;

    location ~ .php {
        fastcgi_pass api;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

And combinations of all of those. Nothing seems to work properly.