0

I have Ubuntu 20.04 LTS server, with Apache2 (mpm_event), PHP 7.4 FPM, postfix (as a relay) installed. This server hosts several sites (WordPress). The problem is that the sites are sending by default from www-data@myhostname.tld. www-data is a unix user running php-fpm, myhostname got from /etc/hostname in my opinion.

The question is how can I change sender address (and sender name optionally) by vhosts configs? I don't want to modify WordPress files 'cause this modifications can be undone due to updates. I'm looking for a way to do this through the Apache configuration files, it looks more rational.

Here is my vhost:

<VirtualHost *:80>
        ServerName mydomain.tld
        ServerAlias www.mydomain.tld
        RewriteEngine On
        RewriteCond %{SERVER_PORT} 80
        RewriteRule ^(.*)$ https://mydomain.tld$1 [R=301,L]
</VirtualHost>

<VirtualHost *:443>
        ServerName mydomain.tld
        ServerAlias www.mydomain.tld
        DocumentRoot /var/www/mydomain.tld
        <Directory /var/www/mydomain.tld>
                Require all granted
                AllowOverride all
        </Directory>

        RewriteEngine On
        RewriteOptions inherit

        RewriteRule \.(svn|git)(/)?$ - [F]

        RewriteCond %{HTTP_HOST}   !^mydomain\.tld [NC]
        RewriteCond %{HTTP_HOST}   !^$
        RewriteRule ^/(.*)         https://mydomain.tld/$1 [L,R]

        <IfModule mod_headers.c>
        Header set X-XSS-Protection "1; mode=block"
        Header always append X-Frame-Options SAMEORIGIN
    </IfModule>

        Include /etc/apache2/ssl_rules/mydomain.tld.conf
</VirtualHost>

I think I can modify php-fpm behavior in vhost somehow.

NukDokPlex
  • 36
  • 1

0 Answers0