centos7 – Apache mod_rewrite P flag is rewriting URL unexpectedly

I’ve recently received a request from the site owner to redirect our base domain to a specific landing page on a subdomain, which is working just fine. The problem is that he wants the URL to remain the same, so the user will see mydomain.com but go to sub.mydomain.com/index.php?landing

I did some research and found that the proper way to redirect a user while keeping the URL intact is to proxy the request, which, as far as I can tell, can be accomplished with the P flag in a RewriteRule. However, despite confirming that mod_proxy is indeed installed via WHM, the URL still gets rewritten to the landing page in the browser. Here’s the relevant section of my .htaccess file for reference:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
RewriteRule ^(.*)$ http://sub.mydomain.com/index.php?landing/ (P)

This is an AWS server using WHM/cPanel on CentOS 7.8 with a standard LAMP stack. I feel like this is probably something simple that I’m overlooking, so hopefully someone can provide some insight. I’ve used mod_rewrite many times in the past, but I’ve never had to proxy a request like this.

centos7 – Storage balancing in elasticsearch cluster

I’ve a Elasticsearch cluster with 5 nodes. I’ve this used storage repartition:

  • Node1: 76%
  • Node2: 94%
  • Node3: 88%
  • Node4: 73%
  • Node5: 74%

How to do to storage balancing/leveling the used storage ?

For the node 2 and 3, we arrived to the watermark threshold and the cluster stuck.

In my others cluster, the used storage is balancing/leveling. Exemple on an other cluster:

  • Node1: 61%
  • Node2: 63%
  • Node3: 60%
  • Node4: 63%
  • Node5: 62%

Thanks

centos7 – Connecting to samba share fails

I have setted up a cluster in mirror of 2 nodes with glusterfs(7.7), everything is working properly, no fails in all the logfiles, CTDB is ok, samba is working properly…but can’t connect from a windows client :-(. Firewall is disabled! Somebody an idea? Checked for samba(4.10.4) bugs but nothing special what could be a block.

centos7 – Centos 7 and Docker 1.13.1 – Error Timeout exceeded while awaiting headers – No proxy and No DNS issue

I am facing this issue and I can find many people also facing this same issue mainly because of DNS and or Proxy.
But in my case, I don’t have proxy, and I confirm the DNS is working well.

(root@ ~)# docker pull hello-world
Using default tag: latest
Trying to pull repository docker.io/library/hello-world ... 
Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

(root@ ~)# # nslookup registry-1.docker.io
Server:         1.1.1.1
Address:        1.1.1.1#53

Non-authoritative answer:
Name:   registry-1.docker.io
Address: 107.23.149.57
Name:   registry-1.docker.io
Address: 52.5.11.128
Name:   registry-1.docker.io
Address: 52.54.232.21
Name:   registry-1.docker.io
Address: 54.85.107.53
Name:   registry-1.docker.io
Address: 52.1.121.53
Name:   registry-1.docker.io
Address: 18.232.227.119
Name:   registry-1.docker.io
Address: 18.213.137.78
Name:   registry-1.docker.io
Address: 52.4.20.24

This issue can be always reproduced anytime:

  1. Install a fresh Centos 7.7 or 7.8 (do yum update or even without)
  2. on if-cfg, add DNS1 & DNS2 = <any public dns such as 1.1.1.1, 8.8.8.8>
  3. Install Docker 1.13.1 (yum install docker (docker.x86_64 2:1.13.1-162.git64e9980.el7.centos))
  4. Start Docker (systemctl start docker)
  5. Pull any docker image (docker pull hello-world)
  6. Error as above

Tried with Docker-CE and no issue at all:

  1. Remove above docker (yum -y remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine)
  2. Install Docker-CE (yum install -y yum-utils; yum-config-manager –add-repo https://download.docker.com/linux/centos/docker-ce.repo; yum -y install docker-ce docker-ce-cli containerd.io)
  3. Start Docker (systemctl start docker)
  4. Pull any docker image (docker pull hello-world)
  5. Image pulled successfully
  6. <test uninstall docker-ce again, then install docker (1.13.1) again, then having the same error again>

I need this Docker 1.13.1 because it’s the dependency of python-tripleoclient which I am trying to test this.

Does anyone also encounter this issue? Or perhaps did I miss something?

centos7 – systemd service fails to authenticate scp between two servers

I have written a service that triggers a shell script to backup a postgres database, on a CentOS7 server. It dumps the backup file into the /tmp/ folder and then it is supposed to copy the file across to another server, but something is amiss, I suspect it is my bash. The service does the backup fine, but fails when it comes to copying it to the other server.

I am able to manually scp the backup file from /tmp/ folder in server1 to the /tmp/ folder in server2 using public key authentication, so passwordless between the two, but I’m not sure why the systemd trips up with the following error:

Aug 17 14:29:34 pcc-home-page-one.novalocal systemd(1): Started backup service for production.
Aug 17 14:29:35 pcc-home-page-one.novalocal backup.sh(1467): Permission denied, please try again.
Aug 17 14:29:35 pcc-home-page-one.novalocal backup.sh(1467): Permission denied, please try again.
Aug 17 14:29:35 pcc-home-page-one.novalocal backup.sh(1467): Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
Aug 17 14:29:35 pcc-home-page-one.novalocal backup.sh(1467): lost connection
Aug 17 14:29:35 pcc-home-page-one.novalocal systemd(1): backup.service: main process exited, code=exited, status=1/FAILURE
Aug 17 14:29:35 pcc-home-page-one.novalocal systemd(1): Unit backup.service entered failed state.
Aug 17 14:29:35 pcc-home-page-one.novalocal systemd(1): backup.service failed.

Here is my bash script:

#!/usr/bin/env bash

today=$(date +"%d-%m-%Y")

pg_dump -U db_backup -h localhost pcc_db >/tmp/backup-${today}.bak

scp /tmp/backup-${today}.bak ifunk@10.88.59.200:/tmp/

and here is the service file:

(Unit)
Description=backup service for production

(Service)
Type=simple
ExecStart=/home/ifunk/backup.sh

What can I do to get get the scp line in the script to work please?

centos7 – wget to an IPv4 server from IPv6-only VPS

I have a CentOS 7 VPS which does not have IPv4, and only has IPv6 networking. I’ve opened up Port 443 for accepting all TCP connections.

When I attempt to wget https://www.litespeedtech.com/packages/6.0/lsws-6.0RC1-ent-x86_64-linux.tar.gz,
it throws an error (which I believe is because https://litespeedtech.com/ is not IPv6 enabled):

Resolving www.litespeedtech.com (www.litespeedtech.com)... 52.55.120.73
Connecting to www.litespeedtech.com (www.litespeedtech.com)|52.55.120.73|:443... failed: No route to host.

When attempting the same for Google (which is IPv6 enabled) wget https://google.com, it succeeds:

Resolving www.google.com (www.google.com)... 2a00:1450:4016:805::2004, 172.217.23.68
Connecting to www.google.com (www.google.com)|2a00:1450:4016:805::2004|:443... connected.
HTTP request sent, awaiting response... 200 OK

How can I connect to IPv4 servers from my IPv6-only VPS? I’ve heard about TunnelBroker but I’m a complete newbie and have no idea on what I should do to configure it.

centos7 – Server is down after changing machine type in Google Cloud Platform

I changed my machine type(GCP) by stopping the instance, after increasing the machine type I restarted the instance and now server stopped working, the website is down now.
Upgraded from 1 vCPU, 1.7 GB memory to 2 vCPU, 4GB memory.
And if I select other than 1 vCPU, 1.7 GB memory, the webserver doesn’t respond.
Also, I can’t access SSH from a web browser it gives me an error that “Connection Failed. We are unable to connect to the VM on port 22.”

Log: https://pastebin.pl/view/2af02149

centos7 – Setup Varnish with Docker for Magento 2

I am a bit confused actually very much confused right not regarding varnish and configuring it. Currently I am running Magento 2 on Nginx/PHP-FPM and only SSL i.e. I am redirecting user from :80 to :443 as I only want them to access over SSL. Also right now, Magento 2 is configured for cache/page_cache and session on Redis (setup on local server). However, I want to use varnish for page cache.

1)
For this, I want to install varnish via docker using given image. I exported the default.vcl file generated from Magento Admin and placed it in /etc/varnish/default.vcl and used following commands:

docker run -e VARNISH_CONFIG_FILE=/etc/varnish/default.vcl
–restart unless-stopped
-v /etc/varnish/default.vcl:/etc/varnish/default.vcl
-Pit –name=varnish-alpine thiagofigueiro/varnish-alpine-docker

In the default.vcl file I configured .port = 6085, however Varnish starts listening to port 32768 instead. It looks like its not reading my default.vcl file.

2.
Currently Nginx is listening to 80 and 443, and if i run varnish with 80:80 it gives me error Address already in use in docker logs. I wanted to run varnish on port 6085 and let magento do the page caching on this port. But from what i researched, it seems as I will have to run varnish on port 80, and then my websites to listen to other port, and redirect traffic on port 80 to the port of website (proxy). Am i right? So the webserver (Nginx) will actually be running on port e.g. 8080 for HTTP, and 8082 for HTTPS, and these ports will be opened within (localhost) only not to public. But then how will varnish communicate on PORT 443?

Is it possible, that I install varnish on a separate server? Or varnish should be installed on the same server as Web server.

If I can install varnish on a separate server, then how can I make it work with nginx (on a different server).

centos – yum install jq is failing intermittently on centos7

jq install is failing intermittently with this error.

http://mirrors.syringanetworks.net/fedora-epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
https://mirrors.xmission.com/fedora-epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
http://mirror.prgmr.com/pub/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
http://mirror.sfo12.us.leaseweb.net/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
https://dfw.mirror.rackspace.com/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
https://ord.mirror.rackspace.com/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
http://fedora.westmancom.com/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
http://fedora.mirrors.pair.com/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
http://mirror.nodesdirect.com/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
http://mirror.twinlakes.net/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
https://mirror.mrjester.net/fedora/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
https://mirror.vcu.edu/pub/gnu+linux/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
https://epel.mirror.constant.com/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
http://mirror.pit.teraswitch.com/fedora/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
https://dl.fedoraproject.org/pub/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
http://mirror.siena.edu/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
https://mirror.dst.ca/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
https://mirror.csclub.uwaterloo.ca/fedora/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
http://packages.oit.ncsu.edu/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
http://mirrors.mit.edu/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
https://sjc.edge.kernel.org/fedora-buffet/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
https://mirror.atl.genesisadaptive.com/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
https://download-cc-rdu01.fedoraproject.org/pub/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
https://mirrors.upr.edu/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
https://mirror.arizona.edu/fedora-epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
http://mirror.oss.ou.edu/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
https://mirrors.sonic.net/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
https://ewr.edge.kernel.org/fedora-buffet/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
http://mirrors.kernel.org/fedora-epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
http://fedora-epel.mirrors.tds.net/fedora-epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
http://mirror.team-cymru.com/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
http://mirror.metrocast.net/fedora/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
https://mirror.dal.nexril.net/fedora-epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
https://mirror.chpc.utah.edu/pub/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
http://mirror.grid.uchicago.edu/pub/linux/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
http://mirror.math.princeton.edu/pub/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
https://mirror.csis.ysu.edu/fedora/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
https://linux-mirrors.fnal.gov/linux/fedora/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
https://mirror.umd.edu/fedora/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
https://mirrors.lug.mtu.edu/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
https://d2lzkl7pfhq30w.cloudfront.net/pub/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
https://mirror.steadfastnet.com/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
http://mirror.coastal.edu/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
http://mirror.rnet.missouri.edu/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
http://mirror.its.dal.ca/pub/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
https://mirror.us-midwest-1.nexcess.net/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
http://reflector.westga.edu/repos/Fedora-EPEL/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
https://iad.mirror.rackspace.com/epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
http://mirrors.liquidweb.com/fedora-epel/7/x86_64/repodata/repomd.xml: (Errno -1) repomd.xml does not match metalink for epel
http://mirror.compevo.com/epel/7/x86_64/repodata/repomd.xml: (Errno 12) Timeout on http://mirror.compevo.com/epel/7/x86_64/repodata/repomd.xml: (28, 'Connection timed out after 30006 milliseconds')
http://dl.iad2.fedoraproject.org/pub/epel/7/x86_64/repodata/repomd.xml: (Errno 14) curl#6 - "Could not resolve host: dl.iad2.fedoraproject.org; Unknown error"

Is anyone else facing the same issue?
Thanks!

centos7 – Port is open and apache is listening but on browser “ERR_CONNECTION_TIMED_OUT” error

i have centos 7 and installed apache server on vps. listening 80, 8002 ports in httpd.conf

Listen 80
Listen 8002

also checked the $ netstat -anp | grep 8002

tcp        0      0 0.0.0.0:8002            0.0.0.0:*               LISTEN      10186/httpd    

there is no problem. it’s listening and I opened the port via firewalld and –reload

here is the opened ports $ firewall-cmd --list-ports, output

80/tcp 8002/tcp

the result is, when I check the on the browser. I can see website on port 80 BUT on <IP address:8002> there is problem. It tries to connect and in the end "ERR_CONNECTION_TIMED_OUT" error is returning.

So I went to terminal and the address with a $ telnet <IP address> 8002 and it returned connected

Additionally I run curl <IP address:8002> and it returned the html without a problem as expected. But I am not very sure why I can’t connect the :8002 on browser. And why I can see the :80… what is the difference?