SSL certificate – Apache2 does not start: (98) Address already used: AH00072: make_sock: unable to bind to address 0.0.0.0:80

there is already something related to this port, that's why apache is complaining.

Try this to find out what uses port 80 / TCP:

# ss --listening --tcp --numeric --processes

you should get a list of open listening sockets with the combination of local address: port and the process that opened each of them. Find out which one has opened port 80, stop this process and restart apache, it should work.

apache2 – Website fine from outside the LAN, but not accessible from inside

I host a private Nextcloud instance on a Raspberry PI on my network. In public domain DNS records, I also have an A record for a subdomain that points to my public (and relatively constant) IP address (let's call it nc.sample.com for the purposes of this question). My router is configured to forward port 443 to my RasPI.

Now the very strange thing is:

When I'm on my cell phone (not connected to my WLAN), I can access https://nc.sample.com without any problems.

When I connect the mobile phone to WLAN (or from any other computer on my network), I can access https: // localIP, but not https://nc.sample.com!

Usually, you would expect things to be the other way around, but I'm pretty lost now because I have never encountered this problem before.

ubuntu – CloudFlare apache2 only allows visitors' IP, refuses all others

I want to allow only known IP addresses. My site is behind cloudflare. On their website, I did the steps to find out the visitor's real IP address: Installation of mod-remoteip

But it is only how to get the original IP address of the visitors. I want to be able to restrict access only to certain IP addresses. Before activating cloudflare, I used this:


     
           ip 191.164.54.65
     
 

What should I use now to allow only the IP addresses I want? So compare them with the visitors' IP address instead of the cloudflare connection IP address? I saw that cloudflare sets the visitor's IP address in

$_SERVER["HTTP_CF_CONNECTING_IP"];
$_SERVER["REMOTE_ADDR"];

Thanks in advance!

apache2 – Apache, redirect does not work for substring

Problem

In apache, how can i redirect to the home page in case you go to the exact channel, but everything behind that channel should be displayed normally, no redirect.

Example.

http://example.com/STRING -> go to homepage
http://example.com/STRING_PAGE -> go to http://example.com/STRING_PAGE

i tried

Redirect 301 /STRING http://example.com/

But in this case, the page is also redirected to the home page, for example in case of http://example.com/STRING_PAGE.

Thank you.

apache2 – how to edit the index.html file using the emacs text editor?

when editing the index.html file with the emacs text editor, it does not display the changes on the apache2 website, someone who can help


Distributor ID: Ubuntu
Description: Ubuntu 16.04.6 LTS
Released: 16.04
Code name: xenial

apache2 – Apache httpd rotatelogs problem

I have Apache httpd on Windows configured to rotate the logs as

CustomLog "|bin/rotatelogs.exe -l -n 5 'C:/Program Files/Apache24/logs/access.log' 86400" common

But it works in a weird way.

If I delete everything access.log files and then a new access.log is created and the logs are correctly written to it, e.g.

::1 - - [06/Feb/2020:20:34:25 +0300] ...

after midnight he starts writing in a new access.log.1 file

::1 - - [07/Feb/2020:00:40:50 +0300] ...

I expected him to rename access.log at access.log.1 and keep writing journals in a clean environment access.log.

What am I doing wrong here please?

https – Where to configure SSL on the Nginx reverse proxy or on Apache2 on the Ubuntu 18.04 server?

My question is about SSL / TLS.

I use the Ubuntu 18.04 server with:
Apache2 serving 3 public domains on 1 public IP.

On the same server I am using:
Nginx and will be configured as a reverse proxy for the 3 domains.

I have to secure the sites with SSL / TLS.

In two areas, I use the latest versions of:
Nextcloud
Rocket.Chat
The third area contains static data.

I will be using Let & # 39; s Encrypt – Certbot for SSL / TLS.

The question is, should I set SSL / TLS for Nginx reverse proxy only (do not host a domain), for Apache only (host all three domains), or should I run Certbot for Nginx and Apache?

My thinking is that since Nginx does not host a domain, there is no need to use SSL / TLS on it, so I think I should treat SSL / TLS as if Nginx doesn’t ; was not even involved and would only apply it to Apache.

All responses are appreciated.

ssl – Redirection loop 301 www to non-www – Nginx + Apache2

Thanks for any help. I am not a server but I am dealing with a server at the moment. I have a site that is in a www to non-www redirect loop. I am using a DigitalOcean Droplet with Ubuntu and Nginx for SSL. I initially had problems getting SSL to work and I created a configuration based on this post on StackExchange: WordPress redirection loop on nginx + apache reverse proxy. The main difference that I had made was to use a 302 redirect in the last server block. However, someone told me to change it to 301 and now I'm passing the loop from www to non-www. Here is my configuration file.

server {
        server_name .mysite.com;
        root /var/www/html;

        # Add index.php to the list if you are using PHP
        index index.php index.html;

        gzip on;
        gzip_types application/javascript image/* text/css;
        gunzip on;

        location ~.(js|css|png|jpg|jpeg) {
                try_files $uri $uri/ =404;
        }

        location / {
                try_files $uri @apache;
        }

        location ~(^?)*/$ { # proxy directories
                proxy_set_header X-Real-IP  $remote_addr;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header X-Forwarded-Host $host;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header Host $host;
                proxy_pass http://127.0.0.1:8080;
        }

        location ~ .php$ { # serve php files
                proxy_set_header X-Real-IP  $remote_addr;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header X-Forwarded-Host $host;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header Host $host;
                proxy_pass http://127.0.0.1:8080;
        }

        location @apache { # used by location /
                proxy_set_header X-Real-IP  $remote_addr;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header X-Forwarded-Host $host;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header Host $host;
                proxy_pass http://127.0.0.1:8080;
        }


        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        location ~ /.ht {
                deny all;
        }

        listen (::):443 ssl ipv6only=on;
        listen 443 ssl;
        ssl_certificate /etc/letsencrypt/live/mysite.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/mysite.com/privkey.pem;
        include /etc/letsencrypt/options-ssl-nginx.conf;
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

}

server {
    listen 80;
    server_name _;
    return 301 https://$host$request_uri;
}

Note: changing the 301 to 302 did not solve the problem.

Help me, thank you!

Edit: I have also confirmed that there is no reference to www.mysite.com in the database. I used WP-CLI to find it. And the home and site URLs have always been without www.

apache2 – Does the Apache reverse proxy to cloudfront without losing the CDN benefits?

The context

I have a cloudfront instance on https://abc.cloudfront.net. Its origin is an S3 bucket serving a static website.

L & # 39; s URL www.cooldomain.com points to an apache server that I control and I can create SSL certificates for this domain. However, I have no control over the DNS server that points www.cooldomain.com to my apache server.

My questions

  1. Is it possible to reverse the proxy of my apache server so that the static assets downloaded on S3 appear to the user from https://www.cooldomain.com? †

  2. If the answer to (1) is yes, will I lose the CDN benefits (since, I suppose, static files served from cloudfront must be transmitted via my apache server and to the end user)?

† Note: I have tried the following code

...
SSLProxyEngine on
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off


    ProxyPass https://abc.cloudfront.net/
    ProxyPassReverse https://abc.cloudfront.net/
    RequestHeader set "Host" "abc.cloudfront.net"
    RequestHeader unset Cookie

reverse proxy my apache server on cloudfront, but it gives me the error The proxy server received an invalid response from an upstream server. I guess it's because cloudfront requires adding a CNAME for my server but, as I said, I can't create SSL certificate on AWS because I don't can't control the DNS server for the cooldomain.com field.

apache2 – Uninstall apache completely on ubuntu

I am trying to remove Apache2 on Ubuntu, but I cannot, I am using

~ $ sudo apt-get remove apache2

~ $ sudo apt-get autoremove apache2

~ $ sudo apt-get autoremove –purge apache2

~ $ sudo apt-get purge apache2

I have tried all of these commands but I cannot delete the apache2, and the repositories and directories remain intact. Can you help me please?