1.0 502 Bad Gateway
After the update of Linux on the web server, the website would not open in the browser. Instead the following error was displayed.
502 Bad Gateway
First we check the nginx server.
$ systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2019-03-21 15:16:47 UTC; 16h ago
Main PID: 1354 (nginx)
Tasks: 8 (limit: 1158)
├─1354 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
└─1355 nginx: worker process
Warning: Journal has been rotated since unit was started.
… Read more
PHP code was not getting executed in the index.html file when the concerned website was opened in a browser. nginx server was being used to serve the web pages.
2.1 Install php7.0-fpm
$ sudo apt-get install php7.0-fpm
2.2 nginx configuration
Add the following lines to the nginx configuration file, /etc/nginx.conf.… Read more
Given an nginx web server log file, we might like to know who are the visitors to our website. One can go line by line through the log file, but that is tedious. It would be nice if we can get one line per client visiting the website, giving the IP address of the visitor and how many times that client has visited.… Read more
While trying to open sitemap.xml of a site served by nginx and built using Drupal CMS, the
404 Not Found error was received. The nginx log file, error.log gave the error as,
80 open() sitemap.xml failed (2: No such file or directory).… Read more
A routine software update on the server running nginx was done. After that the website stopped opening in the browser window and
502 Bad Gateway error along with the nginx version number was displayed. Looking in the log file showed an entry like,
2014/06/26 11:09:53 [crit] 2539#0: *15 connect() to unix:/tmp/php-fpm.sock failed (13: Permission denied) while connecting to upstream, client: 127.0.0.1, server: www.example.com, request: "GET /foo HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-fpm.sock:", host: "www.example.com"
The problem was solved after the following lines were un-commented in the file, /etc/php5/fpm/pool.d/www.conf
listen.owner = www-data
listen.group = www-data
The same file, /etc/php5/fpm/pool.d/www.conf, had the lines
user = www-data
group = www-data
Also, the nginx configuration file /etc/nginx/nginx.conf had the user and group settings,
user www-data www-data;
… Read more
The WPtouch plugin gives a WordPress website the capability to be displayed on mobile devices using a suitable theme. At the end of the web page, there is a toggle button to switch off the mobile theme and use the default desktop theme.… Read more
The configuration is nginx HTTP server, PHP FastCGI Process Manager (PHP-FPM), and the Alternative PHP Cache (APC).
The first step is to download the nginx software from the Nginx website. If using the Ubuntu distribution, following are the steps,
(i) Download the nginx signing keys from the Nginx website,
$ wget http://nginx.org/keys/nginx_signing.key
(ii) Add this key to the apt keyring,
$ sudo apt-key add nginx_signing.key
(iii) Add the following lines at the end of the file, /etc/apt/sources.list
deb http://nginx.org/packages/ubuntu/ version-code nginx
deb-src http://nginx.org/packages/ubuntu/ version-code nginx
In the above two lines, replace version-code, with the value for the relevant Ubuntu version.… Read more