Portál AbcLinuxu, 8. května 2025 00:48
Chyba která se vyhodí při startu apache2 serveru
stroj@stroj:/etc/apache2# /etc/init.d/apache2 restart * Restarting web server apache2 Syntax error on line 1 of /etc/apache2/sites-enabled/000-default: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration [fail]
Předpokládám že jde o to že nejsou povoleny pluginy mod_rewrite, proxy, mozna neco dalsiho..
sites-enable
root@spol:/etc/apache2# cat ./sites-enabled/000-default VirtualHost *:80> ServerAdmin webmaster@localhost Servername sosy.cz DocumentRoot /var/www Directory /> Options FollowSymLinks AllowOverride None /Directory> Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all /Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all /Directory> ErrorLog /var/log/apache2/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/access.log combined Alias /doc/ "/usr/share/doc/" Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 /Directory> /VirtualHost> VirtualHost *:80> ServerAdmin sosy@sosy.cz ServerName sam.sosy.cz RewriteEngine on RewriteBase / RewriteLog /tmp/123 RewriteLogLevel 5 RewriteCond %{HTTP_HOST} (.*)sam.sosy.cz [NC] RewriteRule ^/(.*) http://sosy.lan/$1 [P,QSA,L] /VirtualHost>
vypis z: apache2ctl -l
stroj@stroj:~# apache2ctl -l Compiled in modules: core.c mod_log_config.c mod_logio.c worker.c http_core.c mod_so.c
Jelikož se s apache seznamuji tak jsem zkoušel nastavit mod Rewrite přes rapache gui aplikaci, ale jelikož mi na více PC padala nedala se použít. Nejspíš bude potřeba zapnout pluginy, ale ačkoliv jsem prošel celý adresář /etc/apache2 na nic jsem nenarazil.
Řešení dotazu:
Místo tohoto RewriteCond %{HTTP_HOST} (.*)sam.sosy.cz [NC] RewriteRule ^/(.*) http://sosy.lan/$1 [P,QSA,L] toto: RewriteCond %{HTTP_HOST} (.*)ahoj.neco.ltd [NC] RewriteRule ^/(.*) http://neco.lan/$1 [P,QSA,L] //pzn: příště si dám pozorchtěl sem být inkognito,...
a2enmod rewriteA pro kontrolu konfiguračních souborů není potřeba restartovat apache. Stačí pustit
apache2ctl configtest
Petr
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.