Sunday, March 28, 2021

Recent Questions - Server Fault

Recent Questions - Server Fault


Nginx as reverse proxy for Docker-contained Tomcat

Posted: 28 Mar 2021 08:41 PM PDT

Consider the following diagram:

infraestructure diagram

I have a Debian droplet from Digital Ocean where I need to deploy N Java applications inside individual Docker containers running a Tomcat instance.

Each image has the following Dockerfile configuration:

FROM tomcat:jdk8-openjdk  LABEL maintainer="admin@mail.com"  ADD webapp1.war /usr/local/tomcat/webapps/ #webapp1, webapp2,... webappN  EXPOSE 8080  CMD ["catalina.sh", "run"]  

And is built with:

docker build -t webapp1 .  docker build -t webapp2 .  ...  

Each container is started with the command:

docker run -it -d -p 8081:8080 webapp1  docker run -it -d -p 8082:8080 webapp2  ...  

Every application works correctly and is accesible through the droplet IP address, port and application name:

http://123.123.123.123:8081/webapp1  http://123.123.123.123:8082/webapp2  ...  

But I need to use a domain name (without SSL for now):

http://example.com/webapp1  http://example.com/webapp2  ...  

So I'm using Nginx as reverse proxy to achieve this. The following is the Nginx configuration in sites-available folder I'm using:

default file:

# Default server configuration  #  server {      listen 80 default_server;      listen [::]:80 default_server;        root /var/www/html;        # Add index.php to the list if you are using PHP      index index.html index.htm index.nginx-debian.html;        server_name _;        location / {          try_files $uri $uri/ =404;      }  }  

webapp1 file:

# webapp1 configuration  #  server {    listen 80;      server_name example.com;    access_log /var/log/nginx/tomcat-access.log;    error_log /var/log/nginx/tomcat-error.log;      location / {          proxy_set_header X-Forwarded-Host $host;          proxy_set_header X-Forwarded-Server $host;          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;          proxy_pass http://123.123.123.123:8081/;    }  }  

webapp2 file:

# webapp2 configuration  #  server {    listen 80;      server_name example.com;    access_log /var/log/nginx/tomcat-access.log;    error_log /var/log/nginx/tomcat-error.log;      location / {          proxy_set_header X-Forwarded-Host $host;          proxy_set_header X-Forwarded-Server $host;          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;          proxy_pass http://123.123.123.123:8082/;    }  }  

Here's the problem, when I deployed the first application and made it accesible through the domain name (example.com/webapp1) it was working fine but an 404 error was produced when I try to access example.com (my landing page). I decided to solve this problem later and better to try to deploy a second application. It worked, webapp2 was successfully deployed and was accesible through example.com/webapp2 but now both example.com and example.com/webapp1 are giving an 404 error.

I'm a Nginx and Docker newbie. Please, help.

Why my ubuntu's login page has black screen?

Posted: 28 Mar 2021 07:47 PM PDT

My main board is X570D4I-2T,

I installed ubuntu the latest version.

And the log in page is black screen.

I can use Ctrl+Alt+f2 to go into the terminal screen.

And i use

sudo apt install --reinstall ubuntu-gnome-desktop    

After that, i reboot the system.

It still has the black screen.

What should i do to make log in page back?

Simulate network reset or failure in Windows

Posted: 28 Mar 2021 07:30 PM PDT

I have to check if my server application can recover from transient network failures. The application listens on some ports and is a client to backend services. I would like to run some command or script that would drop and restore all connections.

Is there some tool included in Windows that would allow that? For instance, is there a sequence of route, ipconfig or netsh commands that would drop all connections and allow the machine to resume operation normally?

Maybe disabling the network card device and enabling it back?

Apache2 react app + laravel REST api on same domain

Posted: 28 Mar 2021 06:56 PM PDT

Hello I am having trouble setting up my production server. I have little experience on this topic, I am a programmer but looking to understand more about hosting my own apps without using a third party.

So my goal is I have my domain named example.com conf for example.com

  <VirtualHost *:80>          ServerName example.com          ServerAlias www.example.com          ServerAdmin webmaster@localhost          DocumentRoot /var/www/html/example.com              ErrorLog ${APACHE_LOG_DIR}/error.log          CustomLog ${APACHE_LOG_DIR}/access.log combined    RewriteEngine on  RewriteCond %{SERVER_NAME} =example.com  RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]  </VirtualHost>  

^ this conf is for my react app which contains an .htaccess file:

<IfModule mod_rewrite.c>   RewriteEngine On   RewriteBase /   RewriteCond %{REQUEST_FILENAME} !-f   RewriteCond %{REQUEST_FILENAME} !-d   RewriteCond %{REQUEST_FILENAME} !-l   RewriteRule ^.*$ / [L,QSA]  </IfModule>  

And I have my laravel backend layer which is reffered to in my app as localhost:8000 here is it's conf file

NameVirtualHost *:8000  Listen 8000    <VirtualHost *:8000>                   ServerName laravel.api          ServerAlias www.laravel.api            ServerAdmin webmaster@localhost          DocumentRoot /var/www/html/api.example.com/public            <Directory "/var/www/html/api.example.com/public">                  Options FollowSymLinks Indexes MultiViews                  AllowOverride All                  Order allow,deny                  Require all granted                  ReWriteEngine On          </Directory>              ErrorLog ${APACHE_LOG_DIR}/error.log          CustomLog ${APACHE_LOG_DIR}/access.log combined    RewriteEngine on  RewriteCond %{SERVER_NAME} =example.com  RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]  </VirtualHost>    

In /etc/hosts

# /etc/hosts  127.0.0.1       localhost  127.0.0.1       laravel.api  

Mysql is correctly installed (I have a phpmyadmin.conf that is working perfectly, but is disabled for now, I have alrealy installed my databse and the logins, my laravel .env file has the default mysql port 3306 and my correct login)

My problem is the following: My react app is timing out on the requests.

Error: timeout of 5000ms exceeded      createError createError.js:16      handleTimeout xhr.js:96  

How do I expand my VD on LSI 9361-16i?

Posted: 28 Mar 2021 06:29 PM PDT

I've got a 9361-16I installed in a supermicro sc847. I have the 2 expanders running in a cascaded configuration with both of them chaining off port 0-4 of the card. They are being exposed as enclosure 30 and 31. Array Info

I have 24 Shucked Easystore drives in the front 24 slots running Raid6 for a total of 160TB. I just put 3 newly shucked drives in the back slots and wanted to expand my array onto them as well. I've had absolutely no problems doing this on the front side of the chassis. Array Info When I try to expand (migrate) the array, I get error code 13 Disk doesn't have enough capacity.Failed Command

What I don't understand is why the controller thinks they are a different size because as far as I can tell they are exactly the same Drive E30:S2 Drive E31:S2

Any help would be appreciated!

Cannot connect to a Postgres SQL instance from inside a pod within a GKE

Posted: 28 Mar 2021 07:42 PM PDT

I am new to Terraform and Google Cloud.

I am trying to create a K8 cluster where pods inside the cluster could communicate with a Postgres server I have within the same VPC.

However, when I try to connect to the server using a psql client within a ubuntu pod inside the cluster using psql -h <PRIVATE_IP_OF_POSTGRES_SERVER> -U postgresadmin, it waits for a long time and throws the following timeout error.

psql: could not connect to server: Connection timed out          Is the server running on host "<PRIVATE_IP_OF_POSTGRES_SERVER>" and accepting          TCP/IP connections on port 5432?  

I even tried to telnet <PRIVATE_IP_OF_POSTGRES_SERVER> and that is also not working. (PING is not working as well)

Here is my terraform script for creating the VPC and the K8 cluster:

variable "project_id" {    description = "project id"  }    variable "region" {    description = "region"  }    variable "gke_username" {    default     = ""    description = "gke username"  }    variable "gke_password" {    default     = ""    description = "gke password"  }    variable "gke_num_nodes" {    default     = 1    description = "number of gke nodes"  }    provider "google" {    project = var.project_id    region  = var.region  }    # VPC  resource "google_compute_network" "vpc" {    name                    = "${var.project_id}-vpc"    auto_create_subnetworks = "false"  }    # Subnet  resource "google_compute_subnetwork" "subnet" {    name          = "${var.project_id}-subnet"    region        = var.region    network       = google_compute_network.vpc.name    ip_cidr_range = "10.10.0.0/24"  }    # GKE cluster  resource "google_container_cluster" "primary" {    name     = "${var.project_id}-gke"    location = var.region      remove_default_node_pool = true    initial_node_count       = 1      network    = google_compute_network.vpc.name    subnetwork = google_compute_subnetwork.subnet.name      # Create a VPC-native cluster by configuring `ip_allocation_policy`     ip_allocation_policy {      cluster_ipv4_cidr_block  = "/16"      services_ipv4_cidr_block = "/22"    }      master_auth {      username = var.gke_username      password = var.gke_password        client_certificate_config {        issue_client_certificate = false      }    }  }    # Separately Managed Node Pool  resource "google_container_node_pool" "primary_nodes" {    name       = "${google_container_cluster.primary.name}-node-pool"    location   = var.region    cluster    = google_container_cluster.primary.name    node_count = var.gke_num_nodes      node_config {      oauth_scopes = [        "https://www.googleapis.com/auth/logging.write",        "https://www.googleapis.com/auth/monitoring",      ]        labels = {        env = var.project_id      }        # preemptible  = true      machine_type = "n1-standard-1"      tags         = ["gke-node", "${var.project_id}-gke"]      metadata = {        disable-legacy-endpoints = "true"      }    }  }  

Here is my terraform script file for creating the Postgres server:

variable "project_id" {    description = "project id"  }    variable "region" {    description = "region"  }    terraform {    required_providers {      google = {        source = "hashicorp/google"        version = "3.61.0"      }    }  }    data "google_compute_network" "my_network" {    name = "novade-lite-vpc"  }    provider "google" {    project = var.project_id    region  = var.region  }    resource "random_id" "db_name_suffix" {    byte_length = 4  }    resource "google_compute_global_address" "private_ip_address" {    name          = "private-ip-address"    purpose       = "VPC_PEERING"    address_type  = "INTERNAL"    prefix_length = 16    network       = data.google_compute_network.my_network.self_link  }    resource "google_service_networking_connection" "private_vpc_connection" {    network                 = data.google_compute_network.my_network.self_link    service                 = "servicenetworking.googleapis.com"    reserved_peering_ranges = [google_compute_global_address.private_ip_address.name]  }    resource "google_sql_database_instance" "postgres" {    name             = "postgres-instance-${random_id.db_name_suffix.hex}"    database_version = "POSTGRES_11"    depends_on = [google_service_networking_connection.private_vpc_connection]      settings {      tier = "db-f1-micro"        ip_configuration {        ipv4_enabled    = false        private_network = data.google_compute_network.my_network.self_link      }    }  }    resource "google_sql_database" "default" {    name       = "default"    project    = var.project_id    instance   = google_sql_database_instance.postgres.name    collation  = "en_US.UTF8"    depends_on = [google_sql_database_instance.postgres]  }    resource "google_sql_user" "users" {    name     = "postgresadmin"    instance = google_sql_database_instance.postgres.name    password = "password"    depends_on = [google_sql_database_instance.postgres]  }  

Here is my variables file (Same for both the above scripts):

project_id = "test-project"  region     = "europe-west2"  

Any help is much appreciated! 🙏

How to print the date a table was most recently updated

Posted: 28 Mar 2021 08:58 PM PDT

I have a table that on one page admin can update from a local file to a database on MySQL but on a different page I want users to see how recent that data is. Is there a way I can do this without adding anything to the database itself?

squid 4.10 remove forwarded_for

Posted: 28 Mar 2021 06:03 PM PDT

on a fresh unbuntu 20.04 server we installed squid version 4.10. We hope squid can help completely hide the requesting service's IP address. The goal is to make the squid server not look like a proxy server. So far we have tried

forwarded_for delete  

and

forwarded_for truncate  

and

forwarded_for off  

Each change followed by restarting squid service.

However even the requesting service's actual IP address has been hidden, there are still a list of IP addresses displayed by issuing curl:

curl -x squid-server-IP:3128 ifconfig.me/all  

An example response is:

forwarded: squid-server-IP, IP-1, IP-2, IP-3, IP-4

Using forwarded_for with either off, delete or truncate, IP-1 will always be there, although IP-1 is not the requesting service's IP address, but it seems to be an IP from the cloud service which is hosting our requesting server. And sometimes one of the IP-2,3,4 will be repeating too.

Also following this post, additional directives were added according to the accepted and most upvoted answers, but they do not get rid of the additional IP address in the forwarded list either.

Is there a way to completely remove IP-1,2,3,4? Leaving the squid-server-IP in the field is fine. The goal is to make the squid server not look like a proxy server.

I hope I have explained clear enough, if there is anything needed to clarify please let me know.

Thanks.

Port Forwarding over VPN

Posted: 28 Mar 2021 04:54 PM PDT

I have a site that is behind CG-NAT that stops me from being able to easily open ports. I have setup an openvpn server on a digital ocean droplet and have pfsense onsite configured to connect to it. This bit is all working fine and I can route all traffic over the VPN or selectively based on policy routing.

What I am trying to achieve is to use my new cloud IP address to port forward over the VPN connection.

I have added the below iptables rules which which make the port show up as "filtered" rather than "closed"

iptables -t nat -A PREROUTING -p tcp --dport 21000 -i eth0 -j DNAT --to-destination 10.8.0.2  iptables -t nat -A PREROUTING -p udp --dport 22000 -i eth0 -j DNAT --to-destination 10.8.0.2  iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE      iptables -I FORWARD -i eth0 -p tcp -d 10.8.0.2 --dport 21000 -j ACCEPT  iptables -I FORWARD -i eth0 -p udp -d 10.8.0.2 --dport 22000 -j ACCEPT  

10.8.0.2 - pfsense ip on the vpn tunnel eth0 is the interface with the external IP on my VPS pfsense has firewall rules configured for the ports above on the VPN interface

What am I doing wrong to get the ports opened up to the internet? Is there a better way to do this? Thanks

What does the "same as parent folder" mean in DNS?

Posted: 28 Mar 2021 04:40 PM PDT

I was viewing the DNS management console and I noticed some records having the name "same as parent folder" , so what does it mean and why it is called like this ?

Regards

Random Internal Server Error

Posted: 28 Mar 2021 05:23 PM PDT

We are receiving random internal server errors on one of our website.

These internal server errors can sometimes appear only on some users but other users are not receiving it (at the very same time) and vice versa.

The said internal server errors goes away after several page refresh.

I have confirmed that this is not a script issue. I have tested it by using a test.php that only echoes a test string. Once an internal server error is thrown, even the said test.php throws the same error for a couple of minutes and starts working again after several page refresh.

error logs does not contain anything of relevance with the said error. I have confirmed that error logs are working by intentionally accessing a php script that will throw a fatal error and warning. Both thrown error and warning is logged correctly.

I have also consulted with our hosting which is ipower and they have confirmed that both .htaccess and our php.ini is correct. They even said that PHP is properly installed on our server and should start working properly. As of the moment, we have an open ticket with regards to this and they are still trying to investigate.

If I may add, we are using opencart 3.0.3.7 and the exact clone of our website is working just fine on one of our test domains and other server on the said hosting company.

Are there any other possible causes for the said error to emerge? The answer may seem to be opinionated but please don't hesitate to downvote if necessary and please if possible post a comment on what is/are your thought(s) with regards to this hard to pinpoint oddity

batch windows running process dissapear when explorer restarted

Posted: 28 Mar 2021 04:29 PM PDT

i am running a program (command line tool) through bat file and minimize it to tray using menutools.

sometimes later when a explorer.exe hang or restarted, the bat windows is nowhere to be found but the process still run in the background.

how to reproduce: start cmd, ping localhost and minized to tray using menutools. restart explorer.exe

Q : how to attached the program output into a bat windows again without restarting the process?

Solution: i found that it may have issue with menutools. after using another software to minimize to tray such as trayit! or RBTray, does not produce the issue.

PHP 7.4 with last version of sqlite3

Posted: 28 Mar 2021 05:22 PM PDT

CentOS8 is distributed with sqlite3 version 3.26. I would like to build a php 7.4 RPM with the version 3.35 of sqlite3. Do you any advice to do so ?

Client PC (Win7/Win8) cannot ping to VMware server (CentOS 8), but server can ping client

Posted: 28 Mar 2021 05:55 PM PDT

first of all I'm not a networking technician, so my networking lingo is very much limited.

I'm trying to help my coworker with troubleshooting a problem. So far I only rely on using search engine to find English-language solutions, and I haven't got any for this one.

We're trying to setup a (I quote from him) "web server httpd" using a CentOS 8 running on VMWare (the original server machine is running Win 10 and not a server version). Currently, the CentOS is running this command:

php artisan serve --host 192.168.xx.xx --port 8081

After that, we tried to open the said IP with the port on the vmware CentOS's Firefox. It opens up the intended page. The exact same can be said when I open the same thing on the machine's original OS.

The problem right now is that we can't open the same IP on other PCs (run Win7 and Win10) that is connected to the same ethernet. Pinging the IP via cmd always gives request time out, let alone opening the IP address on a web browser.

What we're trying to achieve is to have the other/client PCs to be able to open up the VMware IP address and thus displays the web server we have. What we've tried so far are listed below, and they haven't worked so far:

  • Turning off the server's PC firewall
  • Stopping the server's VMWare firewalld
  • Changing the VMware network setting from NAT to Bridged
  • Turning off client PC firewall.
  • Changing the IP address of the CentOS VMware to static.

What do we need to do to be able to get what we trying to achieve?

EDIT: just to be clear, the IP address written above is not the real one used, I replaced some number to xx here for privacy reason

RHEL PHP 7.3.5 with mysqlnd and apache

Posted: 28 Mar 2021 06:10 PM PDT

I'll start by stating I'm not a server admin by trade, so I've been struggling with this task.

PHP 7.3.5 was already installed on RHEL7 running Apache. I have installed MySQL successfully and now I am tasked with connecting to the MySQL DB from PHP. I have done this before on hosted services like Bluehost, but they make it easy.

I am trying to install/enable the mysqlnd/mysqli modules to absolutely no avail. phpinfo() still does not show that it's enabled. I have tried to install packages and this is what I see when I locate:

enter image description here

How do I enable this module so it becomes active in PHP?

Updated with command from one of the answers below:

enter image description here

PHP files displayed as text

Posted: 28 Mar 2021 08:04 PM PDT

When I want to execute a php file it's displayed as text in my browser.

I have a VPS at Hostinger I installed Ubuntu 18.04 with Webmin and LAMP(installed automatically).

I checked the installation see below.

apache2 - v and php -v gives me: Apache/2.4.29 and PHP 7.2.24-0ubuntu0.18.04.6

So everything seem to be installed correctly.

My default folder is /var/www/html/ I do not us short tag in my code.

I try to lunch a file called phpinfo.php with content:

<?php  phpinfo();  ?>  

And plain text appear on the page.

If the file begin with html code it's correctly rendered, even with a .php file. But the php part is not executed. e.g:

<!DOCTYPE html>  <html lang="en" dir="ltr">    <head>      <meta charset="utf-8">      <title></title>    </head>    <body>      <h1>Hello</h1>    </body>  </html>    <?php  phpinfo();  ?>  

Render : Hello

But

<?php  phpinfo();  ?>    <!DOCTYPE html>  <html lang="en" dir="ltr">    <head>      <meta charset="utf-8">      <title></title>    </head>    <body>      <h1>Hello</h1>    </body>  </html>  

Render the code as plain text.

Forbidden You don't have permission to access this resource

Posted: 28 Mar 2021 09:04 PM PDT

I have recently installed apache 2.4 plus mod_ssl I am using this apache as a proxy server and redirecting traffic to tomcat.

The issue I am facing right now is that everything works without HTTP but I do see an error when I try to access with https.

Not Found The requested URL was not found on this server.

httpd.conf: This is I am using to redirect the traffic to my tomcat.

<VirtualHost *:80>      ProxyPreserveHost On      ProxyRequests Off      ServerName www.example.com      ServerAlias example.com      ProxyPass / http://localhost:8080/example/      ProxyPassReverse / http://localhost:8080/example/  </VirtualHost>  

Everything work but the site doesn't come up with HTTPS.

Does the ReFS filesystem reserve space for itself?

Posted: 28 Mar 2021 09:24 PM PDT

I recently formatted a single disk from the line of new 14TB Seagates on Windows 10 with ReFS, with a 4K block size, to use the full capacity available and noticed that out of the approximately 12.7TB it presents as usable that it already reports that 100GB has been consumed though the disk is empty.

I checked in disk manager and saw no additional partitions added (plus this would be space consumed within the same partition) and checked for hidden files, but turned up nothing. 100GB consumed for an empty disk seems a little surprising unless it is used for some kind of parity, but also I'm fairly new to using ReFS and don't know all its features.

I've noticed from Microsoft's documentation that ReFS offers something called "mirror-accelerated parity", but I am not using ReFS across two or more disks, but rather a standalone disk. Could the 100GB be reserved for parity or some other feature for preventing data corruption (also mentioned in the Microsoft documentation)? And would it matter if I chose an 8K block size instead?

Any thoughts on what could be using that space?

I am asking this from a security standpoint because I am concerned that to an auditor I wouldn't be able to explain the space usage on a freshly formatted system if there were suspicion of steganography or other forms of hidden data resulting from various methods of hiding malicious software that might actually be occupying space on a drive while not being visible - in environments where monitoring of such things is very strict.

Addendum:

Here is some additional information I pulled about the drive from System Info:

Bytes/Sector: 512  Partitions: 1  Sectors/Track: 63  Tracks/Cylinder: 255  (Total Disk) Size: 12.73TB (14,000,512,296,960)  Total Cylinders: 1,702,132  Total Sectors: 27,344,750,580  Partition: Disk #0,Partition #0  Partition Size: 12.73TB (14,000,383,328,256)  Partition Starting Offset: 135,266,304 bytes  

There is a delta in size between the Total Disk Size and the Partition Size of 122.99GB, but this does not match the now 101GB (seems like it grew by 1GB since I last looked at it - though the disk is still empty) that is reported used. And again, the 101GB is reported as consumed within the partition itself.

The disk is still empty, though I did test creation of a .txt file and then delete it. If there is parity I wonder if creation of that file is what increased the utilization reported (after the fact), even though the file was deleted.

Additional reading on ReFS: - https://www.iperiusbackup.net/en/refs-vs-ntfs-differences-and-performance-comparison-when-to-use/

Can I delete folders in /lib/modules/ after calling "apt-get purge"

Posted: 28 Mar 2021 04:33 PM PDT

I've already call apt-get purge to uninstall the old kernels. But some error occured during the purge that caused the folders to be left behind. It said the folder was not empty so it couldn't delete. To free up disk space can I manually delete those folders that I've purged?

1.1M    ./4.15.0-20-generic  60M     ./4.15.0-32-generic <-- I've purged this  60M     ./4.15.0-30-generic <-- and this  236M    ./4.15.0-33-generic <-- this is my current one  

Can I also remove some of these packages?

un  linux-headers-4.15.0-20-generic                       <none>                          <none>                          (no description available)  ii  linux-headers-4.15.0-30                               4.15.0-30.32                    all                             Header files related to Linux kernel version 4.15.0  ii  linux-headers-4.15.0-30-generic                       4.15.0-30.32                    amd64                           Linux kernel headers for version 4.15.0 on 64 bit x86 SMP  ii  linux-headers-4.15.0-32                               4.15.0-32.35                    all                             Header files related to Linux kernel version 4.15.0  ii  linux-headers-4.15.0-32-generic                       4.15.0-32.35                    amd64                           Linux kernel headers for version 4.15.0 on 64 bit x86 SMP  ii  linux-headers-4.15.0-33                               4.15.0-33.36                    all                             Header files related to Linux kernel version 4.15.0  ii  linux-headers-4.15.0-33-generic                       4.15.0-33.36                    amd64                           Linux kernel headers for version 4.15.0 on 64 bit x86 SMP  rc  linux-image-4.15.0-20-generic                         4.15.0-20.21                    amd64                           Signed kernel image generic  ii  linux-image-4.15.0-33-generic                         4.15.0-33.36                    amd64                           Signed kernel image generic  un  linux-image-unsigned-4.15.0-20-generic                <none>                          <none>                          (no description available)  un  linux-image-unsigned-4.15.0-33-generic                <none>                          <none>                          (no description available)  rc  linux-modules-4.15.0-20-generic                       4.15.0-20.21                    amd64                           Linux kernel extra modules for version 4.15.0 on 64 bit x86 SMP  ii  linux-modules-4.15.0-30-generic                       4.15.0-30.32                    amd64                           Linux kernel extra modules for version 4.15.0 on 64 bit x86 SMP  ii  linux-modules-4.15.0-32-generic                       4.15.0-32.35                    amd64                           Linux kernel extra modules for version 4.15.0 on 64 bit x86 SMP  ii  linux-modules-4.15.0-33-generic                       4.15.0-33.36                    amd64                           Linux kernel extra modules for version 4.15.0 on 64 bit x86 SMP  rc  linux-modules-extra-4.15.0-20-generic                 4.15.0-20.21                    amd64                           Linux kernel extra modules for version 4.15.0 on 64 bit x86 SMP  ii  linux-modules-extra-4.15.0-33-generic  

phpBB in a subfolder behind nginx

Posted: 28 Mar 2021 07:00 PM PDT

I am trying to deploy a phpBB forum behind a load balancer that will distribute the traffic:

  • If https://example.com/forum/*, redirect to instance A (phpbb + nginx)
  • Any other path on https://example.com/, redirect to instance B (other stuff)

Therefore, I want to have phpBB installed on instance A and available under https://example.com/forum/.

On instance A, I am running nginx. Here's my nginx.config (with the important stuff only):

http {      server {          listen [::]:443 http2 ssl default_server;          listen      443 http2 ssl default_server;          server_name example.com;            # PHP BB          root /var/www/mysite/forum/src;            # fastcgi          include /etc/nginx/conf.d/fastcgi-php.conf;            location /forum {              index index.php index.html index.htm;              rewrite ^/forum/(.*) /$1 break;              try_files $uri $uri/ @rewrite_app;          }            location ~ \.php(/|$) {              try_files $uri $uri/ /app.php$is_args$args;              fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;          }            location @rewrite_app {              rewrite ^(.*)$ /app.php/$1 last;          }      }  }  

Here are my problems:

  • When I visit https://example.com/forum/ the forum loads but all internal links are written without the /forum/ path, making the load balancer redirect to instance B.
  • When I visit https://example.com/forum/index.php, internal links are written correctly with the /forum/ path, but I get a phpBB application 404 The page is not found.

What am I doing wrong ?

phpMyAdmin new user can't connect to database

Posted: 28 Mar 2021 05:05 PM PDT

I created a user in phpMyAdmin and I only want to allow query, insert and update operations, and in my php file I am trying to connect to the MySQL database but always get the error Warning: mysqli::mysqli(): (HY000/1045): Access denied for user 'me'@'localhost' (using password: YES), even though I entered the parameter to the mysqli constructor correctly. I read that I should tick the GRANT checkbox for the user however that didn't fix it. What am I missing here? Knowing that if I try it using root and no password I can connect successfully.

Adding Tag (i.e. Source IP) to rsyslog for sending to rsyslog remote server

Posted: 28 Mar 2021 09:04 PM PDT

Is there any way to adding a Tag to Logs which sent by rsyslog? I send these logs to another server, and I can detect source IP as destination, but I need to adding tag in source.

Apache httpd mod_proxy POST issue on home page like abc.com

Posted: 28 Mar 2021 05:05 PM PDT

I have apache server 2.4.18 on centos as a web server in the front end. Now I have multiple websites which are deployed on tomcat 8.0.33 as webapps in the default webapps folder of tomcat.

Configuration on apache end:

<VirtualHost 1.2.3.4:80>      ServerName abc.com      ServerAlias www.abc.com        ProxyPass / http://localhost:8079/abc/      ProxyPassReverse / http://localhost:8079/abc/  </VirtualHost>    <VirtualHost 1.2.3.4:80>      ServerName def.com      ServerAlias www.def.com        ProxyPass / http://localhost:8079/def/      ProxyPassReverse / http://localhost:8079/def/  </VirtualHost>  

Two .war files by the name, abc.war & def.war are deployed to tomcat webapps folder.

abc.com works absolutely fine, as it is just an html site.

but def.com is a dynamic site & it has a login form on home page. The home page after successful login should load user profile page which is: login page url -> def.com user profile page -> def.com/profile.htm

Note that the home page loads successfully (means GET is executing successfully) on browser but when user tries to login(which is a POST request), it somehow tries to load: def.com/def/profile.htm

Also note that if I change configuration to :

<VirtualHost 1.2.3.4:80>      ServerName def.com      ServerAlias www.def.com        ProxyPass /def/ http://localhost:8079/def/      ProxyPassReverse /def/ http://localhost:8079/def/  </VirtualHost>  

then I am successfully able to open def.com/def/ & I can also successfully able to login & open def.com/profile.htm but I want my home page to be on def.com

Elastic Load Balancer awseb-e-g has zero healthy instances

Posted: 28 Mar 2021 06:03 PM PDT

I have an Elastic Beanstalk (EB) set up with a running application on a PHP/Apache server. The application was running OK since many hours ago when the EB's health got subtly RED and I don't know why. No logs was available on EB > My Application > Logs > Request Logs > Full Logs (and also Last 100 Lines).

And these were the last events on my EB until its health got RED, on EB > My Application > Events:

2015-07-11 04:40:43 UTC-0300    WARN    Environment health has transitioned from YELLOW to RED  2015-07-11 04:38:41 UTC-0300    WARN    Environment health has transitioned from GREEN to YELLOW  2015-07-11 04:38:41 UTC-0300    WARN    Elastic Load Balancer awseb-e-g-AWSEBLoa-1H3WKQE404YBT has zero healthy instances.  2015-07-11 04:38:03 UTC-0300    INFO    Removed instance 'i-171a5303' from your environment. (Reason: Instance is in 'shutting-down' state)  2015-07-11 04:31:19 UTC-0300    INFO    Removed instance 'i-c0f3bdd4' from your environment. (Reason: Instance is in 'shutting-down' state)  2015-07-11 04:24:11 UTC-0300    INFO    Removed instance 'i-908daa73' from your environment. (Reason: Instance is in 'shutting-down' state)  

The third event above shows that Load Balancer has zero healthy instances. Why?

Also, we often receive this via email from AWS:

Message: Launching a new EC2 instance. Status Reason: We currently do not have sufficient m3.medium capacity in the Availability Zone you requested (sa-east-1b). Our system will be working on provisioning additional capacity. You can currently get m3.medium capacity by not specifying an Availability Zone in your request or choosing sa-east-1a, sa-east-1c. Launching EC2 instance failed.

If the problem is with the sa-east-1b zone, why didn't AWS automatically launch an instance on sa-east-1a or sa-east-1c zones, as we don't specify any Availability Zone?

We have auto-scaling set up for any Availability Zone. Our Load Balancer is set up for the Availability Zones that we want: sa-east-1a, sa-east-1b or sa-east-1c, but the option Cross-zone load balancing is NOT enabled, because we fear that it might launch instances out of São Paulo (sa-east) region - what we don't want it to do.

So, should I enable the option Cross-zone load balancing on Load Balancing for AWS to get our application up on any Availability Zones in São Paulo (sa-east) region?

Any ideas?!

Restore deleted exchange 2007 public folder from backup .edb file

Posted: 28 Mar 2021 07:06 PM PDT

We are running a stand-alone instance of Exchange 2007 without replication of any kind. We do have nightly backups. A user deleted a public folder, and I need to restore that from one of our full database backups (I have the .edb file).

I have tried creating another storage group, but when I try to create another public folder database, I get an error stating there can only be one public folder database. I also tried using the Recovery Storage Group, but learned that is only usable for mailbox restores. My next thought was to spin up a new Exchange VM and somehow copy it over from there, but I'm not sure if that's best...or how exactly to do it.

What are my best options?

Debian preseed.cfg - Language not set

Posted: 28 Mar 2021 04:13 PM PDT

I'm trying to write a preseed.cfg which should be used for a full automated installation of Debian wheezy. For some reasons the installer is still asking to select a lanugage even if I set this in my preseed.cfg.

I got these options from the official Debian page: https://www.debian.org/releases/wheezy/example-preseed.txt

# Preseeding only locale sets language, country and locale.  d-i debian-installer/language string en  d-i debian-installer/country string DE  d-i debian-installer/locale string en_US.UTF-8  # Optionally specify additional locales to be generated.  d-i localechooser/supported-locales multiselect de_DE.UTF-8  

Error when i install mysql + galera

Posted: 28 Mar 2021 08:04 PM PDT

I want install mysql server + galera in my vps Centos 6.5. When I install

yum update -y && yum install wget libevent perl mysql-y  wget https://launchpad.net/codership-mysql/5.6/5.6.16-25.5/+download/MySQL-server-5.6.16_wsrep_25.5-1.rhel6.x86_64.rpm  wget https://launchpad.net/galera/3.x/25.3.5/+download/galera-25.3.5-1.rhel6.x86_64.rpm  rpm -Uvh --force MySQL-server-5.6.16_wsrep_25.5-1.rhel6.x86_64.rpm  rpm -Uvh galera-25.3.5-1.rhel6.x86_64.rpm  

terminal show:

[root@db1 ~]# /etc/init.d/mysql status ERROR! MySQL is not running, but lock file (/var/lock/subsys/mysql) exists  [root@db1 ~]# rm -rf /var/lock/subsys/mysql   [root@db1 ~]# /etc/init.d/mysql start  Starting MySQL. ERROR! The server quit without updating PID file (/var/lib/mysql/db1.pid).  [root@db1 ~]# cat /var/lib/mysql/db1.err   140517 11:19:56 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql  140517 11:19:56 mysqld_safe WSREP: Running position recovery with --log_error='/var/lib/mysql/wsrep_recovery.zt0hQM' --pid-file='/var/lib/mysql/db1-recover.pid'  2014-05-17 11:19:57 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).  140517 11:19:57 mysqld_safe WSREP: Failed to recover position:  2014-05-17 11:19:57 10980 [Note] Plugin 'FEDERATED' is disabled. 2014-05-17 11:19:57 10980 [Note] InnoDB: Using atomics to ref count buffer pool pages 2014-05-17 11:19:57 10980 [Note] InnoDB: The InnoDB memory heap is disabled 2014-05-17 11:19:57 10980 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2014-05-17 11:19:57 10980 [Note] InnoDB: Compressed tables use zlib 1.2.3 2014-05-17 11:19:57 10980 [Note] InnoDB: Using Linux native AIO 2014-05-17 11:19:57 10980 [Note] InnoDB: Not using CPU crc32 instructions 2014-05-17 11:19:57 10980 [Note] InnoDB: Initializing buffer pool, size = 128.0M InnoDB: mmap(137363456 bytes) failed; errno 12 2014-05-17 11:19:57 10980 [ERROR] InnoDB: Cannot allocate memory for the buffer pool 2014-05-17 11:19:57 10980 [ERROR] Plugin 'InnoDB' init function returned error. 2014-05-17 11:19:57 10980 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 2014-05-17 11:19:57 10980 [ERROR] Unknown/unsupported storage engine: InnoDB 2014-05-17 11:19:57 10980 [ERROR] Aborting 2014-05-17 11:19:57 10980 [Note] Binlog end 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'partition' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'INNODB_SYS_FIELDS' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'INNODB_SYS_INDEXES' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'INNODB_SYS_TABLES' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'INNODB_FT_CONFIG' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'INNODB_FT_DELETED' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'INNODB_METRICS' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'INNODB_CMPMEM' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'INNODB_CMP_RESET' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'INNODB_CMP' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'INNODB_LOCK_WAITS' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'INNODB_LOCKS' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'INNODB_TRX' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'BLACKHOLE' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'ARCHIVE' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'MEMORY' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'MRG_MYISAM' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'CSV' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'MyISAM' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'sha256_password' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'mysql_old_password' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'mysql_native_password' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'wsrep' 2014-05-17 11:19:57 10980 [Note] Shutting down plugin 'binlog' 2014-05-17 11:19:57 10980 [Note] /usr/sbin/mysqld: Shutdown complete  

This is my my.cnf

[root@db1 ~]# cat /etc/my.cnf   [mysqld]  datadir=/var/lib/mysql  socket=/var/lib/mysql/mysql.sock  user=mysql  # Disabling symbolic-links is recommended to prevent assorted security risks  symbolic-links=0  

**¿How can i install galera + mysql?*

Force ssh to ignore id_rsa permissions

Posted: 28 Mar 2021 08:44 PM PDT

I have a very specific requirement that requires a private key to be used by multiple users. I know how bad this is. The problem is that if the identity file's permission is to permissive (444 in my case) ssh will simply ignore them.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @          WARNING: UNPROTECTED PRIVATE KEY FILE!          @  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@  Permissions 0444 for '/var/vendor/id_rsa' are too open. It is  recommended that your private key files are NOT accessible by others.  This private key will be ignored.  

From the man pages

Contains the private key for authentication. These files contain sensitive data and should be readable by the user but not accessible by others (read/write/execute). ssh will simply ignore a private key file if it is accessible by others.

Is there a way to force ssh to use the key without checking the permissions?

Load balancing architecture: sticky sessions and dynamic backends

Posted: 28 Mar 2021 06:03 PM PDT

I'm struggling to find a solution to a specific load balancing requirement. It seems that various combinations of HAProxy, Nginx, Varnish and Apache's mod_proxy_balancer can do some but not all of what we need. My question is whether anyone can suggest a suitable configuration that would (perhaps including software that we may not have considered, but it will need to be FOSS).

The key requirement is, unfortunately, sticky sessions. We have a large, complex Tomcat app that somewhat abuses the HTTP Session, and it utilises frameworks that do the same. Converting to a stateless design or replicated session have both been investigated and discounted. Additionally, the stickiness MUST be based on a cookie and not an IP hash as we have large spikes from corporate clients where many thousands of users can all appear to be hitting the site at the same time from the same IP address.

Second most important requirement is a dynamic backend. This application runs in a cloud (not AWS) and app servers come and go from time to time based on automatic or manual scaling.

Thirdly, we need to be able to mark servers as "quiescing" so that they will continue to honour existing sessions but will not be handed new ones. When all current sessions end, the server can be turned off or upgraded/restarted.

There are some additional complications/requirements but it's meeting the three above that seems to be presenting the most difficulty.

From research so far, I think the following statements are true:

  • Nginx/Varnish can't meet the sticky session requirement (based on cookies) but HAProxy and Apache can
  • HAProxy can't do dynamic backend modification without a restart (might be ok if it's quick though). Varnish can with some VCL changes and a HUP, as could Nginx with some creative config file management I think. Apache can possibly handle this via a managed interface to mod_proxy_balancer..?
  • I'm not sure if/how any of them can deal with the third requirement

Would really appreciate any pointers or insights.

Reverse Proxy (mod_rewrite) and Rails (absolute paths)

Posted: 28 Mar 2021 07:06 PM PDT

I have front end rails app, that reverse proxies to any of a number of backend rails apps depending on URL, for example

http://www.my_host.com/app_one reverse proxies to http://www.remote_host_running_app_one.com

such that a URL like http://www.my_host.com/app_one/users will display the contents of http://www.remote_host_running_app_one.com/users

I have a large, and ever expanding number of backends, so they can not be explicitly listed anywhere other than a database. This is no problem for mod_rewrite using a prg:/ rewrite map reverse proxy.

The question is, the urls returned by rails helpers have the form /controller/action making them absolute to the root. This is a problem for the page served by mod_rewrite because links on the proxied page appear as absolute to the domain. i.e.:

http://www.my_host.com/app_one/controller/action has links that end up looking like /controller/action/ when they need to look like /app_one/controller/action

mod_proxy_html seems like the right idea, but it doesn't seem to be as dynamic as I would need, since the rules need to be hard coded into the config files.

Is there a way to fix this server-side, so that the links will be routed correctly?

No comments:

Post a Comment