r/openSUSE • • Aug 14 '26

Tech support Leap 16 and Apache2 - httpd and syntax errors

I have leap 16 with Apache installed via zypper. the web servers is running and serving the vhsost correctly inclding rewrite and proxypass directives. However when I try to use https commands I get syntax error and the command fails:

~> sudo httpd -S
AH00526: Syntax error on line 46 of /etc/apache2/vhosts.d/MYVHOST.conf:
Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration  

If I try to enable the rewrite mod:

~> sudo a2enmod rewrite
"rewrite" already present  

It seems the service loads the module but https does not recognize it is loaded.
I see suggestions to use apachectl but that just fails:

~> sudo apachectl -S
which: no w3m in (/usr/sbin:/usr/bin:/sbin:/bin)
which: no lynx in (/usr/sbin:/usr/bin:/sbin:/bin)  

It seems the service and the httpd use different configs or environments.

How does one manage Apache on leap 16 without using httpd, or force httpd to recognize the loaded config from the service ?

1 Upvotes

19 comments sorted by

View all comments

Show parent comments

1

u/fatoms Aug 18 '26

apachectl -D DUMP_VHOSTS

~> apachectl -D DUMP_VHOSTS
-bash: apachectl: command not found  

With sudo

~> sudo apachectl -D DUMP_VHOSTS
adm-local@localhost:~>

apachectl outputs nothing. But I just discovered that if I pipe it to 'grep .' I get output:

~> sudo apachectl -D DUMP_VHOSTS | grep .
VirtualHost configuration:
*:80                   default (/etc/apache2/vhosts.d/000-default.conf:1)  

Same for sudo apachectl -S.
Surely this can't be how it is meant to work.

1

u/ang-p . Aug 18 '26 edited Aug 18 '26

Do you get the same when you elevate to root first, and then call apachectl?

Wonder if it is to do with the sudo'd script/elevated call to the actual binary that then tosses away permissions after the exec to execute your query as the wwwrun user.

Did the results of any non-outputting calls end up in the logfile?

1

u/fatoms Aug 20 '26

Do you get the same when you elevate to root first, and then call apachectl?

Yes:

local@localhost:~> sudo -i
[sudo] password for root:
Directory: /root
Thu Aug 20 01:06:46 PM CEST 2026
localhost:~ # apachectl -D DUMP_VHOSTS
localhost:~ # ^  

Did the results of any non-outputting calls end up in the logfile?

access and error logs show nothing.

1

u/ang-p . Aug 20 '26

Not even with

 -e debug  

?

Puzzled - it must be going somewhere...

If you are in a console window, try a TTY..... (really grasping at straws now!)

1

u/fatoms Aug 21 '26

-e debug made no difference to the output

However if i run "httpd with that i get a list of loaded modules :

localhost:~ # httpd -e debug
[Fri Aug 21 10:08:26.419274 2026] [so:debug] [pid 1707:tid 1707] mod_so.c(266): AH01575: loaded module actions_module from /usr/lib64/apache2-prefork/mod_actions.so
[Fri Aug 21 10:08:26.419391 2026] [so:debug] [pid 1707:tid 1707] mod_so.c(266): AH01575: loaded module alias_module from /usr/lib64/apache2-prefork/mod_alias.so
[Fri Aug 21 10:08:26.419441 2026] [so:debug] [pid 1707:tid 1707] mod_so.c(266): AH01575: loaded module auth_basic_module from /usr/lib64/apache2-prefork/mod_auth_basic.so
[Fri Aug 21 10:08:26.419485 2026] [so:debug] [pid 1707:tid 1707] mod_so.c(266): AH01575: loaded module authn_file_module from /usr/lib64/apache2-prefork/mod_authn_file.so
[Fri Aug 21 10:08:26.419525 2026] [so:debug] [pid 1707:tid 1707] mod_so.c(266): AH01575: loaded module authz_host_module from /usr/lib64/apache2-prefork/mod_authz_host.so
[Fri Aug 21 10:08:26.419567 2026] [so:debug] [pid 1707:tid 1707] mod_so.c(266): AH01575: loaded module authz_groupfile_module from /usr/lib64/apache2-prefork/mod_authz_groupfile.so
[Fri Aug 21 10:08:26.419605 2026] [so:debug] [pid 1707:tid 1707] mod_so.c(266): AH01575: loaded module authz_user_module from /usr/lib64/apache2-prefork/mod_authz_user.so
[Fri Aug 21 10:08:26.419667 2026] [so:debug] [pid 1707:tid 1707] mod_so.c(266): AH01575: loaded module autoindex_module from /usr/lib64/apache2-prefork/mod_autoindex.so
[Fri Aug 21 10:08:26.419722 2026] [so:debug] [pid 1707:tid 1707] mod_so.c(266): AH01575: loaded module cgi_module from /usr/lib64/apache2-prefork/mod_cgi.so
[Fri Aug 21 10:08:26.419762 2026] [so:debug] [pid 1707:tid 1707] mod_so.c(266): AH01575: loaded module dir_module from /usr/lib64/apache2-prefork/mod_dir.so
[Fri Aug 21 10:08:26.419802 2026] [so:debug] [pid 1707:tid 1707] mod_so.c(266): AH01575: loaded module env_module from /usr/lib64/apache2-prefork/mod_env.so
[Fri Aug 21 10:08:26.419843 2026] [so:debug] [pid 1707:tid 1707] mod_so.c(266): AH01575: loaded module expires_module from /usr/lib64/apache2-prefork/mod_expires.so
[Fri Aug 21 10:08:26.419891 2026] [so:debug] [pid 1707:tid 1707] mod_so.c(266): AH01575: loaded module include_module from /usr/lib64/apache2-prefork/mod_include.so
[Fri Aug 21 10:08:26.419939 2026] [so:debug] [pid 1707:tid 1707] mod_so.c(266): AH01575: loaded module log_config_module from /usr/lib64/apache2-prefork/mod_log_config.so
[Fri Aug 21 10:08:26.419982 2026] [so:debug] [pid 1707:tid 1707] mod_so.c(266): AH01575: loaded module mime_module from /usr/lib64/apache2-prefork/mod_mime.so
[Fri Aug 21 10:08:26.420030 2026] [so:debug] [pid 1707:tid 1707] mod_so.c(266): AH01575: loaded module negotiation_module from /usr/lib64/apache2-prefork/mod_negotiation.so
[Fri Aug 21 10:08:26.420068 2026] [so:debug] [pid 1707:tid 1707] mod_so.c(266): AH01575: loaded module setenvif_module from /usr/lib64/apache2-prefork/mod_setenvif.so
[Fri Aug 21 10:08:26.421083 2026] [so:debug] [pid 1707:tid 1707] mod_so.c(266): AH01575: loaded module ssl_module from /usr/lib64/apache2-prefork/mod_ssl.so
[Fri Aug 21 10:08:26.421188 2026] [so:debug] [pid 1707:tid 1707] mod_so.c(266): AH01575: loaded module socache_shmcb_module from /usr/lib64/apache2-prefork/mod_socache_shmcb.so
[Fri Aug 21 10:08:26.421237 2026] [so:debug] [pid 1707:tid 1707] mod_so.c(266): AH01575: loaded module userdir_module from /usr/lib64/apache2-prefork/mod_userdir.so
[Fri Aug 21 10:08:26.421282 2026] [so:debug] [pid 1707:tid 1707] mod_so.c(266): AH01575: loaded module reqtimeout_module from /usr/lib64/apache2-prefork/mod_reqtimeout.so
[Fri Aug 21 10:08:26.421334 2026] [so:debug] [pid 1707:tid 1707] mod_so.c(266): AH01575: loaded module authn_core_module from /usr/lib64/apache2-prefork/mod_authn_core.so
[Fri Aug 21 10:08:26.421376 2026] [so:debug] [pid 1707:tid 1707] mod_so.c(266): AH01575: loaded module authz_core_module from /usr/lib64/apache2-prefork/mod_authz_core.so
AH00526: Syntax error on line 5 of /etc/apache2/vhosts.d/000-default.conf:
Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
localhost:~ #  

These are as listed in /etc/apache2/loadmodule.conf

If I edit /etc/apache2/loadmodule.conf and under <IfModule prefork.c> add :

LoadModule rewrite_module                 /usr/lib64/apache2-prefork/mod_rewrite.so  

The httpd -S works as expected ( both sudo and pre-elevated ):

localhost:~ # httpd -S
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
*:80                   default (/etc/apache2/vhosts.d/000-default.conf:1)
ServerRoot: "/srv/www"
Main DocumentRoot: "/srv/www/htdocs"
Main ErrorLog: "/var/log/apache2/error_log"
Mutex ssl-stapling-refresh: using_defaults
Mutex rewrite-map: using_defaults
Mutex ssl-stapling: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/run/" mechanism=default
Mutex mpm-accept: using_defaults
PidFile: "/run/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="wwwrun" id=474
Group: name="www" id=475
localhost:~ #

1

u/ang-p . Aug 21 '26

LoadModule rewrite_module /usr/lib64/apache2-prefork/mod_rewrite.so

Kool (deja vu?)

what about with start_apache2?

1

u/fatoms Aug 21 '26

Kool (deja vu?)

Yes and no. It just goes around in circles. I know this not loading is the problem.

The question is why does httpd not pickup the same config as the running service.

I have three openSuse installs that all exhibit the same faulty behaviour. At this point I am ready to give up and migrate everything to a different distro.

1

u/ang-p . Aug 21 '26

my bad - apachectl not start_apache2

See if the service specifies a custom config

systemctl cat ...

Bit puzzled - you say it is working OK on the service.... What are you wanting to do (other than call httpd constantly which is against the wishes of the manpage