AWS EKS – cannot access apache httpd behind a LoadBalancer

I've deployed an apache httpd server in a container and am attempting to expose it externally via a LoadBalancer. Although I can log on to the local host and get the expected response (curl -X GET localhost) when I try and access the external URL exposed by the load balancer I get an Empty reply from server:

curl -X GET ad8d14ea0ba9611e8b2360afc35626a3-553331517.us-east-1.elb.amazonaws.com:5000
curl: (52) Empty reply from server

Any idea what I am missing - is there some kind of additional redirection going on that I'm unaware of?

The yaml is here:

apiVersion: apps/v1
kind: Deployment
metadata:
name: apache
labels:
app: apache
spec:
replicas: 1
selector:
matchLabels:
pod: apache
template:
metadata:
name: apachehost
labels:
pod: apache
spec:
containers:
- name: apache
image: myrepo/apache2
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: apache
labels:
app: apache
spec:
type: LoadBalancer
selector:
pod: apache
ports:
- name: port1
port: 5000
targetPort: 80

Questions about setting up a LAMP server on raspbian stretch

I am about to setup a LAMP server on my raspberry pi, my plan is to use a external drive for my website files, configure https and then I want to port forward to put the website online, however I have a few questions

Is it a good idea to mount the external drive to the path that Apache uses by default or is it better to create a different directory for that?

I was also wondering which steps I should take regarding DNS records and file structure when I want to setup a subdomain, do I create a new folder in the root directory with the name of my subdomain? And which DNS records and files do I edit afterwards?

My last question is if I should just install MariaDB, PHP etc on the raspberry pi itself or if I have to point files/install paths to the external drive

Thank you for your time

How to combine a http->https redirect with a 404 redirect to /

Let's say I have a website. mywebsite.com

I want http to always redirect to https: - http://mywebsite.com to https://mywebsite.com - http://mywebsite.com/any-page-url to https://mywebsite.com/any-page-url - http://subdomain.mywebsite.com to https://subdomain.mywebsite.com

I currently have this working fine using the following in the .htaccess at the root of my server.

RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Now, in my specific subdomain, let's say /www/subdomain I want all 404 to redirect to the root of that website. So for example, if http://subdomain.mywebsite.com/ksjhskf does not exist, redirect to http://subdomain.mywebsite.com.

For this, I added the following in a .htaccess in /www/subdomain:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . / [L,R=301]

Now, the http to https redirect no longer works on my subdomain subdomain.

How can I make both work concurrently?

Timeout when starting Tomcat from Eclipse

My server.xml is configured to use Apache in connection to Tomcat. If I start Tomcat with startup.sh, it works fine because I can access a simple html-file located in webapps/ROOT at port 80 and 443. Netstat -tulpn shows that a java process occupies the 8005 and 8009 ports. Then I run shutdown.sh, and the netstat shows the ports are no longer occupied. I try to start Tomcat from Eclipse. The console says it is started within 10000ms. The ports 8005 and 8009 are occupied by a javaprocess, but in Eclipse I get timeout, and the state of the server is 'Starting'. I try to start a html-script that calls the restful web service, but I get 503 Service unavailable. I've stuggled with this the whole day. I do not understand what to do with this. Please help !

Failed to load resource: net::ERR_CERT_AUTHORITY_INVALID

I am implementing node js script over https.

Node js

const options = {
  key: fs.readFileSync('private.key'),
  cert: fs.readFileSync('cert.crt'),    
  // This is necessary only if using the client certificate authentication.
  requestCert: true,
  rejectUnauthorized: true,

  // This is necessary only if the client uses the self-signed certificate.
  ca: [fs.readFileSync('client-cert.pem')]
};

On each request this is giving error:- ERR_CERT_AUTHORITY_INVALID

I have searched a lot but nothing found.

I use below command for generating client key:-

openssl req -x509 -newkey rsa:2048 -keyout client-key.pem -out client-cert.pem -days 365

I create .crt and private keys on server and using them.

What I am doing wrong here?

Getting 502 proxy error while trying to write rewriterule

I have a domain int.business.com. When I hit this I want the browser to show the contents in the domain www.data.business.com but the users should still see int.business.com in the address bar. Here is my vhost configuration

RewriteEngine on
SSLProxyEngine on 
RewriteRule ^/(.*)$ int.business.com [P]
ProxyPassReverse / data.newbusiness.com

With this configuration, I am getting a 502 proxy error

Proxy Error
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /.

Reason: Error reading from remote server

Any suggestions on how to solve this.

How do I install my github project to the root directory with composer?

I'm making a request handler for php, which will route requests to specific files on the server. I have a .htaccess file that routes every request to DOCUMENT_ROOT/Server/handleRequest.php, which then handles everything else from there. To make this work, I copy the .htaccess file and Server folder to the root folder for my site.

I've been successful in getting composer to install my project to the vendor directory under vendor/JakarCo/PHP-Request-Handler. I would like all the files (at the very least, the .htaccess file) to be installed directly into the site's document root folder (one level above the vendor folder).

I am trying to use oomphinc/composer-installers-extender to set a custom path, and it's not working, and I can't figure out how to fix it.

The composer.json in the request handler is

{
    "name": "JakarCo/PHP-Request-Handler",
    "description": "php request handler",
    "type": "library",
    "license": "proprietary",
    "require": {
        "php": "^5.3.6 || ^7.0",
        "oomphinc/composer-installers-extender": "@dev"
    },
    "extra": {
        "installer-types": ["library"],
        "installer-paths": {
            "my/path/": ["JakarCo/PHP-Request-Handler/"],
            "path/to/libraries/JakarCo/": ["type:library"]
        }  
    }
}

The composer.json for the project that is including the request handler is:

{
    "repositories": [
        {
            "url": "https://github.com/JakarCo/PHP-Request-Handler",
            "type": "vcs"
        }
    ],
    "require": {
        "JakarCo/PHP-Request-Handler": "dev-master"
    }
}

When I run composer update from from the site's root folder, it runs successfully (now with nothing to change). So I deleted the vendor folder and the composer.lock file and ran composer install and had three successful installs, of composer/installer, the oomphinc one, and mine. But mine is still going into the vendor/JakarCo/PHP-Request-Handler, when the Server folder and .htaccess files need to go into the site's root folder.

I suspect my problem is with installer-paths, but I can't figure out how it's supposed to be. Also, I'm probably not supposed to use @dev for the oomphinc version, but I don't know what else to put.

I'm experienced with PHP, but very out of practice, and am new to using composer and git.

Just another Blog Hosting Sites site