Score:0

Different senders for different VHosts

pg flag

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 [email protected]. 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.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.