0

On a Centos 8, I added a SetEnv into my VirtualHost conf:

<VirtualHost *:XXXX> Alias /static/ /opt/industrialisation/xxxx/xxxx/xxxx/ <Directory /opt/industrialisation/xxx/xxxx/> Require all granted <Files wsgi.py> Require all granted </Files> </Directory> WSGIDaemonProcess myproject python-home=/opt/venv/venv-xxxxx python-path=/opt/industrialisation/xxxx/xxxxx/ WSGIProcessGroup myproject WSGIScriptAlias / /opt/industrialisation/xxxx/xxxx/xxxxx/wsgi.py SetEnv VARIABLE_NAME variable_value </VirtualHost> 

I stop and start httpd service :

[root@xxxxx ~]# systemctl stop httpd.service [root@xxxxx ~]# systemctl start httpd.service 

The service is running well :

[root@xxxxxxx ~]# systemctl status httpd.service ● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) Drop-In: /usr/lib/systemd/system/httpd.service.d └─php-fpm.conf Active: active (running) since Mon 2023-03-06 21:57:56 CET; 5min ago Docs: man:httpd.service(8) Main PID: 49075 (httpd) Status: "Total requests: 1; Idle/Busy workers 100/0;Requests/sec: 0.00313; Bytes served/sec: 19 B/sec" Tasks: 231 (limit: 22084) Memory: 43.4M CGroup: /system.slice/httpd.service ├─49075 /usr/sbin/httpd -DFOREGROUND ├─49076 /usr/sbin/httpd -DFOREGROUND ├─49077 /usr/sbin/httpd -DFOREGROUND ├─49078 /usr/sbin/httpd -DFOREGROUND ├─49079 /usr/sbin/httpd -DFOREGROUND └─49080 /usr/sbin/httpd -DFOREGROUND mars 06 21:57:56 xxxxxxx.xxxxxxx.net systemd[1]: Starting The Apache HTTP Server... mars 06 21:57:56 xxxxxxx.xxxxxxx.net systemd[1]: Started The Apache HTTP Server. mars 06 21:57:56 xxxxxxx.xxxxxxx.net httpd[49075]: Server configured, listening on: port xxx, port xxxx, port xxxx 

I check if the variable is available but it is not :

[root@xxxxxxx ~]# cat /proc/49075/environ | tr '\0' '\n' LANG=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin NOTIFY_SOCKET=/run/systemd/notify INVOCATION_ID=a3e117c7287b445b9b9932f7ec8883b1 JOURNAL_STREAM=9:220753 

Also I thought that system variable (like HOSTNAME) would be available to the process httpd but I only see these 5 variables.

Is it normal? Is it a problem with my check from proc? I'm confused.

2
  • 1
    SetEnv sets variable for Apache own use, SetEnv does not set system variables. All you can do with system variables is preload them before running httpd and invoke them in your httpd config, not the other way around. The httpd docs specify it clearly. mod_env "This module allows for control of internal environment variables that are used by various Apache HTTP Server modules" Commented Mar 25, 2023 at 18:18
  • Thanks so much for your answer. Commented Mar 26, 2023 at 17:19

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.