Hi i have problem with installing angular with nginx and pm2 i think i installed all prerequisites tools to installing angular on ubuntu ec2 with nginx but i always get the error 502 bad gateway my site hierarchically : /var/www/html/myproject-angular/   inside myproject-angular directory :  ar  en  server-ar  server-ar.js  server-en  server-en.js  inside config /etc/nginx/conf.d/default.conf : server {     listen 80 default_server;      root /var/www/html/myproject-angular/dist;      index index.html index.htm index.php;      server_name some.something.com;      location / {         try_files $uri $uri/ /index.php$is_args$args;     }      location ~ \.php$ {         include snippets/fastcgi-php.conf;         fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;     } }  inside sites-available /etc/nginx/sites-available/some.something.com server {     listen 80;     listen 127.0.0.1;     listen [::]:80 default_server ipv6only=on;     return 301 https://some.something.com$request_uri; } server {     # Enable HTTP/2     listen 443 ssl http2;     listen [::]:443 ssl http2;     server_name some.something.com;       ssl_certificate /home/ubuntu/something.pem;     ssl_certificate_key /home/ubuntu/something.key;       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:4200/;         proxy_ssl_session_reuse off;         proxy_set_header Host $http_host;         proxy_cache_bypass $http_upgrade;         proxy_redirect off;     } }  error log of nginx: 2020/11/27 21:02:55 [error] 9018#9018: *9 connect() failed (111: Connection refused) while connecting to upstream, client: *100.100.100.100*, server: some.something.com, request: &quot;GET /favicon.ico HTTP/2.0&quot;, upstream: &quot;http://127.0.0.1:4200/favicon.ico&quot;, host: &quot;some.something.com&quot;, referrer: &quot;https://some.something.com/&quot;
18
This is a  about Connection Refused    We see a lot of questions to the effect      When I try to connect to a system I get a message      Connection refused      Why is this ?
70448
By now I've not used SNI with nginx yet. But as IP address pools are quite filled and commercial XP support is about to cease (finally) I'm thinking about converting a few sites to SNI.  I'm aware of the general limitations and pitfalls that might come along with SNI (XP issue, very old browsers). But beyond that is there anything I should be aware of?   Like - nginx related pitfalls when using SNI - issues/bugs with recent (notable!) browsers
99154
I'm trying to figure out how to set a default host for my nginx installation. I found this article in the nginx Wiki:    Unfortunately, this doesn’t work. After restarting I get this:  Restarting nginx: nginx: [emerg] unknown directive "http" in /etc/nginx/sites-enabled/catchall:1 nginx: configuration file /etc/nginx/nginx.conf test failed   After removing the http directive I get this:  Restarting nginx: nginx: [emerg] unknown log format "main" in /etc/nginx/sites-enabled/catchall:7 nginx: configuration file /etc/nginx/nginx.conf test failed   I’m on Ubuntu 10.04.3 where I’m using the official nginx PPA. Version 1.0.9 of nginx is running.
118241
I'm trying to set up my environment such that surveyadmin.local points at one directory and surveyadmin.local/api points at another.  However, no matter what I change, the /api URL always results in a call to the directory that surveyadmin.local is pointing at. Here's a sample error from the error log specified in the vhost config:  2013/08/09 17:20:07 [error] 8911#0: *1 open() "/srv/http/surveytool/admin/build/app.php" failed (2: No such file or directory), client: 10.0.2.2, server: surveyadmin.local, request: "GET /api/organizations HTTP/1.1", host: "surveyadmin.local"   Note that the error refers to a path of /srv/http/surveytool/admin/buid/, instead of the /srv/http/surveytool/api/SurveyTool/web/ that was expected.  Here's my config for the vhost in question:  server {     listen 80;     server_name surveyadmin.local;      location / {         root /srv/http/surveytool/admin/build;         index index.html;     }      location /api {         root /srv/http/surveytool/api/SurveyTool/web;         index app.php;         try_files $uri $uri/ /app.php?$query_String;         location ~ \.php(?|$) {             fastcgi_pass unix:/var/run/php5-fpm.sock;             fastcgi_index app.php;             fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;             include /etc/nginx/fastcgi_params;         }     }     access_log  /var/log/nginx/surveyadmin.access.log;     error_log   /var/log/nginx/surveyadmin.error.log debug; }   I have tried changing the word "root" to "alias" under the location /api block. I've tried setting up a second virtual host and doing a proxy forward (with proxy_pass) to that vhost.  This seems like it shouldn't be that difficult, so I'm assuming my error is a simple one that I just haven't seen yet.  Can anyone spot any obvious problems with the above config?
121467
This is exactly what I have set up right now:   cd /var/www mkdir -p test cd /var/www/test sudo nano index.html cd /etc/apache2/sites-available sudo nano test.conf   &lt;VirtualHost *:80&gt;     ServerName localhost223.com     DocumentRoot /var/www/test &lt;/VirtualHost&gt;    $sudo a2ensite test.conf $sudo service apache2 reload   I can access my page like this:file:///var/www/test/index.html in web browser.  &lt;html&gt;     &lt;h1&gt;          here     &lt;/h1&gt; &lt;/html&gt;   But I cannot do access: http://localhost223.com  I get the error: Could not resolve host  How to resolve this issue?
114119
Where should I put systemd file for e.g. Nginx nginx.service or something like that on Ubuntu 16.04 ?
31202
During system installation from a Desktop LiveCD (10.10) I checked the "Download updates during installation" option.  Before starting the install I had configured an apt proxy server.  The proxy server was configured by writing  Acquire::http { Proxy "http://apt-proxy-server:3142"; };   to the new file /etc/apt/apt.conf.d/02proxy on the running system booted from the LiveCD.  This proxy was used correctly for my various package installs on the live system prior to launching the system installation GUI.  It accesses apt-cacher-ng running in non-transparent mode on the machine apt-proxy-server.  However, the downloads taking place during the installation are not using this proxy.  I verified that the file 02proxy had not been changed or removed.  Is there a way to force usage of an APT proxy during installation?
26425
Hello guys  When I run   sudo nano /etc/proftpd/proftpd.conf  I get this error :   sudo unable to resolve host localhost.localdomain  I'm trying to set DefaultRoot to /var/wwwas per the following screenshots.    When I press CTRl + X then write Y and press enter,/kbd> it give me this error     Can someone please tell me how to resolve this problem?
78200
I installed nginx a while ago using the ubuntu PPA repository.  Now I want to compile nginx from source so I can compile in and use the geo-ip module.  I know how to compile the new nginx from source.  How can I remove the nginx binary which was installed by the package?  I want to leave all the configs and logs and upstart stuff etc untouched.  I really just want to remove the old binary.  How can I do this?
30410
I am having trouble getting pip to work behind a corporate firewall. I added the http and https proxies to my /etc/environment file, and if I execute echo "$HTTP_PROXY" it prints the right thing. However, if I execute env or printenv none of the proxy variables show up. I think this is why pip is failing too. Any insight would be appreciated. My /etc/environment file looks like  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games" http_proxy="http://&lt;stuff&gt;.&lt;stuff&gt;.org:80" HTTP_PROXY="http://&lt;stuff&gt;.&lt;stuff&gt;.org:80" https_proxy="https://&lt;stuff&gt;.&lt;stuff&gt;.org:443" HTTPS_PROXY="https://&lt;stuff&gt;.&lt;stuff&gt;.org:443"   And I added the same lines to my ~/.bashrc file as well.
120687
I have a website served by nginx behind an AWS ELB Load Balancer. Only HTTPS is enabled on the load balancer.  Requesting individual files, or directories with a trailing slash, work fine. However, requesting directories without a trailing slash don't work.  The reason is, when I request the directory without the trailing slash, nginx does a redirect to the path with the trailing slash (that's OK), but it also changes from HTTPS to HTTP. The load balancer is configured to only allow HTTPS, so that doesn't work (timeout).  On the nginx logfile, I can see that the request reaches nginx, and that it's nginx that responds with the 301 Permanent Redirect (so it's not e.g. a problem with the load balancer setup).  10.100.10.15 - - [24/Nov/2017:15:41:08 +0000] "GET /admin HTTP/1.1" 301 178 "-" "Wget/1.18 (darwin16.0.0)"   When I request the URL via curl I see the redirect:  $ curl -v https://example.com/admin *   Trying 1.2.3.4... * TCP_NODELAY set * Connected to example.com (1.2.3.4) port 443 (#0) * TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 * Server certificate: example.com * Server certificate: Amazon * Server certificate: Amazon Root CA 1 * Server certificate: Starfield Services Root Certificate Authority - G2 &gt; GET /admin HTTP/1.1 &gt; Host: example.com &gt; User-Agent: curl/7.54.0 &gt; Accept: */* &gt;  &lt; HTTP/1.1 301 Moved Permanently &lt; Date: Mon, 27 Nov 2017 09:19:05 GMT &lt; Content-Type: text/html &lt; Content-Length: 178 &lt; Connection: keep-alive &lt; Server: nginx &lt; Location: http://example.com/admin/ &lt; X-UA-Compatible: IE=Edge &lt;  &lt;html&gt; &lt;head&gt;&lt;title&gt;301 Moved Permanently&lt;/title&gt;&lt;/head&gt; &lt;body bgcolor="white"&gt; &lt;center&gt;&lt;h1&gt;301 Moved Permanently&lt;/h1&gt;&lt;/center&gt; &lt;hr&gt;&lt;center&gt;nginx&lt;/center&gt; &lt;/body&gt; &lt;/html&gt; * Connection #0 to host example.com left intact   My nginx config file is just   server {     root /var/www; }   The /etc/nginx/nginx.conf is .  I have tried server_name_in_redirect off but it did not make any difference.  I would like to avoid putting the hostname in the config file, because this is packed into a Docker image which is then deployed on different hosts (QA, Prod, etc.).  I would like nginx to do this redirect, but stay on HTTPS. What can I do?
10696
I've tried it a 100 times I'm really new to Ubuntu and ended with a bunch of error that I don't even understand can any one please help me??  Here is what I did:   I installed PHP  I installed libcurl then php5-dev I tried installing PECL extension and it says PHPIZE not found.
75499
I have the following nginx config, e.g.  server {         listen   80;         server_name example.com         allow 127.0.0.0/8;   When I restart, it warn me:  Restarting nginx: nginx: [warn] server name "127.0.0.0/8" has suspicious  symbols in /etc/nginx/sites-enabled/xxx   Any idea?
96973
I'm having a strange issue with nginx and PHP-FPM. I have a server set up to serve downloads for my website. It's not very beasty, it's only a Celeron G530 and 4GB of RAM, because of this, I'm running nginx for its low overhead. The server is typically transfering at 30-40Mbps constantly and the port is 100Mbps.   The problem is, when I'm requesting some PHP scripts from the server over HTTP the request often times out. I know the time limit in nginx is 60 seconds, and I've verified through the logs that it's hitting that time and closing the connection.  I also have  running on the server to monitor things, and while this is still over HTTP, on the same server and under the same conditions, it's very quick and snappy with a page load taking no longer than 150ms.  In my head it makes logical sense that the problem lies with PHP-FPM (as far as I know Munin uses Perl), but how can I check this? What can I do to drill down on the problem and see what the actual bottlenecks are?  If it is PHP-FPM, what can I do to perhaps speed things up? It's not taking up a lot of CPU or RAM, and it's set up to use a socket connection rather than a TCP one with nginx.  Thanks for any help.
70867
... but still be required for applications that need admin privilegies?  In order to allow the following:  $ apache2ctl restart httpd not running, trying to start (13)Permission denied: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs  $ sudo !! sudo apache2ctl restart             #no password asked $                                   #works!   For reference I've seen this setup on amazon's e3 instances  Any idea?
94185
I don't know what is going on. I double value for worker connections but it still return error.  server { server_name xxx.com;  root /var/www/web; index index.html index.htm index.php; error_log /var/log/nginx/error.log; location / { proxy_http_version 1.1; proxy_set_header   Host $http_host; proxy_set_header   X-Real-IP $remote_addr; proxy_set_header   Upgrade $http_upgrade; proxy_set_header   Connection "upgrade"; proxy_cache_bypass $http_upgrade; proxy_pass         http://127.0.0.1:7777; }        listen 443 ssl; # managed by Certbot     ssl_certificate /etc/letsencrypt/live/xxx.com/fullchain.pem; # managed by Certbot     ssl_certificate_key /etc/letsencrypt/live/xxx.com/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 {     listen 80;     server_name xxx.com;     return 301 https://$host$request_uri; # managed by Certbot  }   Everything is okej with this code?  ERROR:  Firstly was:  worker_connections are not enough worker_connections are not enough   Now is  27513#0: accept4() failed (24: Too many open files) 27513#0: accept4() failed (24: Too many open files) 27513#0: accept4() failed (24: Too many open files) 27513#0: accept4() failed (24: Too many open files)
23776
I've checked out quite a few other answers to similar questions as well as tutorials on DigitalOcean, etc., with no success. Sorry for what is probably a very obvious problem - I'm new to this.  Essentially, I need to set up redirects so that http://, ., and . all redirect to https://.  Currently, https:// works fine and http:// redirects to https://. I need to redirect www traffic because the SSL cert is only configured for non-www. However, when I've tried to add another server block to the config to redirect www (http and https) to https://, the server closes the connection on all 4 variants.  Here's my config:  # HTTP - redirect to HTTPS server {     listen 80;     server_name www.example.com example.com;     return 301 https://example.com$request_uri; }  # HTTPS www - redirect to non-www RESETS CONNECTION #server { #    listen 443; #    server_name www.example.com; #    return 301 https://example.com$request_uri; #}   # HTTPS — proxy all requests to the Node app server {     # Enable HTTP/2     listen 443 ssl http2;     server_name example.com;      # Use the Let’s Encrypt certificates     ssl_certificate /etc/not/my/path/live/example.com/fullchain.pem;     ssl_certificate_key /etc/not/my/path/live/example.com/privkey.pem;      # Include the SSL configuration from cipherli.st     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://0.0.0.0:2368/;         proxy_ssl_session_reuse off;         proxy_set_header Host $http_host;         proxy_cache_bypass $http_upgrade;         proxy_redirect off;     } }   Can anyone tell me what I'm doing wrong? Again I know it's probably painfully obvious but I just can't get this to work. Should I be doing this with something other than an NGINX redirect?