Error module rewrite does not exist

I'm new to server administration but I was able to get a LAMP setup running on my new VPS. I uploaded a few web files that work on my other server, but they seem to give me the error: "File does not

ERROR: Module rewrite does not exist
February 21, 2014 by Sharad Chhetri Leave a Comment

While working on Apache Module in Ubuntu,I found rewrite problem in Apache Web Server.I tried to enable the rewrite module but got this error ERROR: Module rewrite does not exist!.After troubleshooting,I found the problem was with mod_rewrite module.

After doing some more troubleshooting,it is found that the rewrite.load file was missing in /etc/apache2/mods-available/ .

Now,I checked the mod_rewrite.so actual module file and Wow it was there.

Below given is step by step command which I ran,to solve this issue.Here is the reference from my system

root@tuxworld:~# a2enmod rewrite

ERROR: Module rewrite does not exist!

root@tuxworld:~# ls -l /usr/lib/apache2/modules/mod_rewrite.so

-rw-r—r— 1 root root 58728 May 28 2020 /usr/lib/apache2/modules/mod_rewrite.so

root@tuxworld:~#

root@tuxworld:~# echo «LoadModule rewrite_module

/usr/lib/apache2/modules/mod_rewrite.so» > /etc/apache2/mods-available/rewrite.load

root@tuxworld:~#

root@tuxworld:~# a2enmod rewriteEnabling module rewrite.

To activate the new configuration, you need to run:

service apache2 restart

root@tuxworld:~#

After this I restarted the apache2 service

sudo service apache2 restart

While working on Apache Module in Ubuntu,I found rewrite problem in Apache Web Server.I tried to enable the rewrite module but got this error ERROR: Module rewrite does not exist!.After troubleshooting,I found the problem was with mod_rewrite module.

After doing some more troubleshooting,it is found that the rewrite.load file was missing in /etc/apache2/mods-available/ .

Now,I checked the mod_rewrite.so actual module file and Wow it was there.

Below given is step by step command which I ran,to solve this issue.Here is the reference from my system

root@tuxworld:~# a2enmod rewrite
ERROR: Module rewrite does not exist!
root@tuxworld:~# ls -l /usr/lib/apache2/modules/mod_rewrite.so
-rw-r--r-- 1 root root 58728 Jul 12  2013 /usr/lib/apache2/modules/mod_rewrite.so
root@tuxworld:~# 
root@tuxworld:~# echo "LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so" > /etc/apache2/mods-available/rewrite.load
root@tuxworld:~# 
root@tuxworld:~# a2enmod rewriteEnabling module rewrite.
To activate the new configuration, you need to run:
  service apache2 restart
root@tuxworld:~# 

After this I restarted the apache2 service

sudo service apache2 restart

Problem is solved now.

  • Печать

Страницы: [1]   Вниз

Тема: не работает mod_rewrite в apache  (Прочитано 23640 раз)

0 Пользователей и 1 Гость просматривают эту тему.

Оффлайн
ilimer

ubuntu Gutsy+apache2+php5; не работает mod_rewrite в apache, на все попытки написать что-либо похожее на:
RewriteEngine On
RewriteBase /
RewriteRule ^oldstuff.html$ newstuff.html

 в .htaccess, ругается 500 err, подскажите в чём может быть дело?


Оффлайн
ritov

Включаем  mod_rewrite:

sudo a2enmod rewrite

он создает симлинк в папке mods-enabled
в принципе, можно вместо вышеприведенного короткого кода написать и длинный:

ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/
После этого нужно в виртуальном хосте для твоего сайта (лежит в /etc/apache2/sites-available) написать:

<VirtualHost *>
        RewriteEngine On
</VirtualHost>

После этого перезагрузить апач:

sudo /etc/init.d/apache2 reload
Но после этого у меня НЕ РАБОТАЕТ почему то!

Помогите!

« Последнее редактирование: 11 Декабря 2007, 15:47:20 от ritov »


Оффлайн
svm

У мну тоже  не заработал этот модуль:

даю команду:

sudo /etc/init.d/apache2 restart

выдает:

* Restarting web server apache2
* We failed to correctly shutdown apache, so we're now killing all running apache processes. This is almost certainly suboptimal, so please make sure your system is working as you'd expect now!
apache2: Syntax error on line 183 of /etc/apache2/apache2.conf:
Syntax error on line 1 of /etc/apache2/mods-enabled/rewrite.load:
Cannot load /usr/lib/apache2/modules/mod_rewrite.so into server: /usr/lib/apache2/modules/mod_rewrite.so: invalid ELF header
                                                                         [fail]

делал все как тут — http://attic.krampo.info/2006/01/31/howto-enable-mod_rewrite-apache2-ubuntu/
как бы это дело поправить?

« Последнее редактирование: 12 Декабря 2007, 08:41:14 от svm »


Оффлайн
ilimer

у меня заработало.
тупо скопировал rewrite.load из mods-available в  mods-enabled. Перегрузил сервак и всё заработало. 
В описании виртуального хоста ничего относящегося к mod_rewrite не прописывал.

.htaccess выглядит примерно так:

RewriteEngine On
RewriteRule ^([a-z0-9]+)/$ /engine.php?activeid=$1

« Последнее редактирование: 13 Декабря 2007, 04:50:44 от ilimer »


Оффлайн
ilimer

плюс на линакс форуме советовали следующее:
<Directory «/var/www»>
# Possible values for the Options directive are «None», «All»,
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that «MultiViews» must be named *explicitly* — «Options All»
# doesn’t give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs-2.2/mod/core.html#options
# for more information.
Options All
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be «All», «None», or any combination of the keywords:
# Options FileInfo AuthConfig Limit
AllowOverride All
# Controls who can get stuff from this server.
Order allow,deny
Allow from all
</Directory>

Options All по умолчанию None

и надеюсь что в httpd2 -M rewrite_module (shared)

но к этому моменту у меня всё уже заработало…

« Последнее редактирование: 13 Декабря 2007, 04:51:11 от ilimer »


Оффлайн
ritov

Но после этого у меня НЕ РАБОТАЕТ почему то!
Помогите!

Заработало! Все, что я написал выше — абсолютно правильно и достаточно.

Проблема была в том, что у меня в VirtualHost было написано AllowOverride None — а это просто отключает .htaccess в котором у меня прописана реврайт рулы. Вот такая ламерская ошибка :) Написал  AllowOverride All и все работает.

« Последнее редактирование: 20 Декабря 2007, 00:00:33 от ritov »


Оффлайн
arayakao

А мне не помогли все сказанные рекомендации, что делать ?


Оффлайн
PIRATUS

Но после этого у меня НЕ РАБОТАЕТ почему то!
Помогите!

Заработало! Все, что я написал выше — абсолютно правильно и достаточно.

Проблема была в том, что у меня в VirtualHost было написано AllowOverride None — а это просто отключает .htaccess в котором у меня прописана реврайт рулы. Вот такая ламерская ошибка :) Написал  AllowOverride All и все работает.

Спасибо Друг!!! Цены тебе нет. Я почти год мучался с этим mod_rewrite. А ведь всё указывало на то что он включен.


Оффлайн
AnrDaemon

Если нет абсолютной и совершенной необходимости использовать .htaccess — использовать его не стоит.
Пишите всё в виртуалхост.

Хотите получить помощь? Потрудитесь представить запрошенную информацию в полном объёме.

Прежде чем [Отправить], нажми [Просмотр] и прочти собственное сообщение. Сам-то понял, что написал?…


Оффлайн
xxq

Сделал все как написано выше, но мне это не помогло. Подскажите что еще можно проверить или сделать?


Оффлайн
AnrDaemon

Сделал ЧТО? Не помогло В ЧЁМ?
Извини, но телепаты вымерли от перенапряжения лет шесть назад.

Хотите получить помощь? Потрудитесь представить запрошенную информацию в полном объёме.

Прежде чем [Отправить], нажми [Просмотр] и прочти собственное сообщение. Сам-то понял, что написал?…


Оффлайн
xxq

Простите, я не знал что телепаты все вымерли.
Мод реврайт в настройках апача включен, но почему-то не хочет работать. В конфиге виртуального хоста сменил параметр AllowOverride None на AllowOverride All и дописал RewriteEngine On. Что я мог сделать не так и какие конфиги мне нужно проверить?


Оффлайн
AnrDaemon

RewiteLog
RewriteLogLevel
И читать вывод модуля.

Хотите получить помощь? Потрудитесь представить запрошенную информацию в полном объёме.

Прежде чем [Отправить], нажми [Просмотр] и прочти собственное сообщение. Сам-то понял, что написал?…


  • Печать

Страницы: [1]   Вверх

Forum rules
There are no such things as «stupid» questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help. Topics in this forum are automatically closed 6 months after creation.

johnnya23

Level 1
Level 1
Posts: 48
Joined: Fri Mar 09, 2018 10:06 am

Trying to install apache

I got to this issue:

Code: Select all

john@lap-top ~ $ ps ax
  PID TTY      STAT   TIME COMMAND
    1 ?        Ss     0:03 /sbin/init splash
    2 ?        S      0:00 [kthreadd]
    4 ?        I<     0:00 [kworker/0:0H]
    6 ?        I<     0:00 [mm_percpu_wq]
    7 ?        S      0:00 [ksoftirqd/0]
    8 ?        I      1:01 [rcu_sched]
    9 ?        I      0:00 [rcu_bh]
   10 ?        S      0:00 [migration/0]
   11 ?        S      0:00 [watchdog/0]
   12 ?        S      0:00 [cpuhp/0]
   13 ?        S      0:00 [cpuhp/1]
   14 ?        S      0:00 [watchdog/1]
   15 ?        S      0:00 [migration/1]
   16 ?        S      0:00 [ksoftirqd/1]
   18 ?        I<     0:00 [kworker/1:0H]
   19 ?        S      0:00 [cpuhp/2]
   20 ?        S      0:00 [watchdog/2]
   21 ?        S      0:00 [migration/2]
   22 ?        S      0:03 [ksoftirqd/2]
   24 ?        I<     0:00 [kworker/2:0H]
   25 ?        S      0:00 [cpuhp/3]
   26 ?        S      0:00 [watchdog/3]
   27 ?        S      0:00 [migration/3]
   28 ?        S      0:00 [ksoftirqd/3]
   30 ?        I<     0:00 [kworker/3:0H]
   31 ?        S      0:00 [kdevtmpfs]
   32 ?        I<     0:00 [netns]
   33 ?        S      0:00 [rcu_tasks_kthre]
   34 ?        S      0:00 [kauditd]
   37 ?        S      0:00 [khungtaskd]
   38 ?        S      0:00 [oom_reaper]
   39 ?        I<     0:00 [writeback]
   40 ?        S      0:00 [kcompactd0]
   41 ?        SN     0:00 [ksmd]
   42 ?        SN     0:01 [khugepaged]
   43 ?        I<     0:00 [crypto]
   44 ?        I<     0:00 [kintegrityd]
   45 ?        I<     0:00 [kblockd]
   48 ?        I<     0:00 [ata_sff]
   52 ?        I<     0:00 [md]
   53 ?        I<     0:00 [edac-poller]
   54 ?        I<     0:00 [devfreq_wq]
   55 ?        I<     0:00 [watchdogd]
   58 ?        S      0:07 [kswapd0]
   59 ?        S      0:00 [ecryptfs-kthrea]
  101 ?        I<     0:00 [kthrotld]
  102 ?        I<     0:00 [acpi_thermal_pm]
  107 ?        I<     0:00 [ipv6_addrconf]
  116 ?        I<     0:00 [kstrp]
  133 ?        I<     0:00 [charger_manager]
  185 ?        S      0:04 [irq/30-DLLC6AE:]
  186 ?        S      0:00 [scsi_eh_0]
  187 ?        I<     0:00 [scsi_tmf_0]
  188 ?        S      0:00 [scsi_eh_1]
  189 ?        I<     0:00 [scsi_tmf_1]
  190 ?        S      0:00 [scsi_eh_2]
  191 ?        I<     0:00 [scsi_tmf_2]
  192 ?        S      0:00 [scsi_eh_3]
  193 ?        I<     0:00 [scsi_tmf_3]
  197 ?        S      0:11 [i915/signal:0]
  198 ?        S      0:00 [i915/signal:1]
  199 ?        S      0:00 [i915/signal:2]
  200 ?        S      0:00 [i915/signal:4]
  204 ?        I<     0:06 [kworker/3:1H]
  207 ?        I<     0:01 [kworker/2:1H]
  311 ?        I<     0:00 [kworker/0:1H]
  313 ?        S      0:12 [jbd2/sda6-8]
  314 ?        I<     0:00 [ext4-rsv-conver]
  316 ?        I<     0:00 [kworker/1:1H]
  359 ?        Ss     0:02 /lib/systemd/systemd-journald
  384 ?        Ss     0:00 /sbin/lvmetad -f
  390 ?        Ss     0:00 /lib/systemd/systemd-udevd
  516 ?        I<     0:00 [cfg80211]
  527 ?        S      1:10 [irq/47-iwlwifi]
  677 ?        I      0:00 [kworker/1:1]
  928 ?        Ssl    0:02 /usr/lib/accountsservice/accounts-daemon
  932 ?        Ss     0:02 /usr/sbin/acpid
  934 ?        Ss     0:00 /sbin/cgmanager -m name=systemd
  935 ?        Ssl    0:01 /usr/sbin/rsyslogd -n
  940 ?        Ssl    0:00 /usr/sbin/ModemManager
  942 ?        Ss     0:00 /usr/sbin/cron -f
  945 ?        Ss     0:00 /lib/systemd/systemd-logind
  949 ?        Ssl    0:09 /usr/sbin/thermald --no-daemon --dbus-enable
  953 ?        Ss     2:01 /usr/bin/dbus-daemon --system --address=systemd: --no
  970 ?        I<     0:00 [kmemstick]
  971 ?        I      0:16 [rtsx_usb_ms_1]
  972 ?        Ssl    3:11 /usr/sbin/NetworkManager --no-daemon
  975 ?        Ss     0:00 /usr/lib/bluetooth/bluetoothd
  976 ?        Ss     0:06 avahi-daemon: running [lap-top-2.local]
 1060 ?        Ss     0:07 /usr/sbin/irqbalance --pid=/var/run/irqbalance.pid
 1131 ?        SLsl   0:00 /usr/sbin/lightdm
 1137 ?        S      0:00 avahi-daemon: chroot helper
 1144 ?        Ssl    0:00 /usr/lib/policykit-1/polkitd --no-debug
 1157 tty7     Ssl+  32:01 /usr/lib/xorg/Xorg -core :0 -seat seat0 -auth /var/ru
 1205 ?        Ssl    0:00 /usr/lib/colord/colord
 1218 ?        Ssl    4:52 /usr/sbin/mysqld
 1265 ?        Ss     0:07 /sbin/wpa_supplicant -u -s -O /run/wpa_supplicant
 1373 ?        S      0:06 /usr/sbin/dnsmasq --no-resolv --keep-in-foreground --
 1476 tty1     Ss+    0:00 /sbin/agetty --noclear tty1 linux
 1484 ?        Ssl    0:08 /usr/lib/upower/upowerd
 1541 ?        Ss     0:35 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 109:116
 1634 ?        Sl     0:00 lightdm --session-child 12 19
 1825 ?        I      0:01 [kworker/u8:0]
 1883 ?        Ss     0:00 /lib/systemd/systemd --user
 1884 ?        S      0:00 (sd-pam)
 1889 ?        SLl   15:10 /usr/bin/gnome-keyring-daemon --daemonize --login
 1891 ?        Ssl    0:00 cinnamon-session --session cinnamon
 2030 ?        Ss     0:00 /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-s
 2035 ?        S      0:00 /usr/bin/dbus-launch --exit-with-session /usr/bin/im-
 2056 ?        Ss     0:55 /usr/bin/dbus-daemon --fork --print-pid 5 --print-add
 2109 ?        Sl     0:02 /usr/lib/x86_64-linux-gnu/cinnamon-settings-daemon/cs
 2111 ?        Sl     0:00 /usr/lib/x86_64-linux-gnu/cinnamon-settings-daemon/cs
 2120 ?        Sl     0:00 /usr/lib/x86_64-linux-gnu/cinnamon-settings-daemon/cs
 2142 ?        Sl     0:02 /usr/lib/x86_64-linux-gnu/cinnamon-settings-daemon/cs
 2145 ?        Sl     0:02 /usr/lib/x86_64-linux-gnu/cinnamon-settings-daemon/cs
 2147 ?        Sl     0:00 /usr/lib/x86_64-linux-gnu/cinnamon-settings-daemon/cs
 2151 ?        Sl     0:00 /usr/lib/x86_64-linux-gnu/cinnamon-settings-daemon/cs
 2156 ?        Sl     0:00 /usr/lib/x86_64-linux-gnu/cinnamon-settings-daemon/cs
 2161 ?        Sl     0:11 /usr/bin/pulseaudio --start --log-target=syslog
 2162 ?        SNsl   0:01 /usr/lib/rtkit/rtkit-daemon
 2165 ?        Sl     0:00 /usr/lib/x86_64-linux-gnu/cinnamon-settings-daemon/cs
 2169 ?        Sl     0:00 /usr/lib/x86_64-linux-gnu/cinnamon-settings-daemon/cs
 2171 ?        Sl     0:00 /usr/lib/x86_64-linux-gnu/cinnamon-settings-daemon/cs
 2177 ?        Sl     0:00 /usr/lib/x86_64-linux-gnu/cinnamon-settings-daemon/cs
 2178 ?        Sl     0:00 /usr/lib/x86_64-linux-gnu/cinnamon-settings-daemon/cs
 2179 ?        Sl     0:00 /usr/lib/x86_64-linux-gnu/cinnamon-settings-daemon/cs
 2180 ?        Sl     0:00 /usr/lib/x86_64-linux-gnu/cinnamon-settings-daemon/cs
 2193 ?        Sl     0:00 /usr/lib/at-spi2-core/at-spi-bus-launcher --launch-im
 2194 ?        Sl     0:00 /usr/lib/x86_64-linux-gnu/cinnamon-settings-daemon/cs
 2199 ?        S      0:13 /usr/bin/dbus-daemon --config-file=/etc/at-spi2/acces
 2201 ?        Sl     0:04 /usr/lib/at-spi2-core/at-spi2-registryd --use-gnome-s
 2206 ?        Sl     0:00 /usr/lib/x86_64-linux-gnu/cinnamon-settings-daemon/cs
 2211 ?        Sl     0:00 /usr/lib/gvfs/gvfsd
 2217 ?        Sl     0:00 /usr/lib/gvfs/gvfsd-fuse /run/user/1000/gvfs -f -o bi
 2219 ?        Sl     0:00 /usr/lib/x86_64-linux-gnu/cinnamon-settings-daemon/cs
 2232 ?        Sl     0:01 /usr/lib/x86_64-linux-gnu/cinnamon-settings-daemon/cs
 2241 ?        Sl     0:00 /usr/lib/x86_64-linux-gnu/cinnamon-settings-daemon/cs
 2257 ?        Sl     0:00 /usr/lib/dconf/dconf-service
 2319 ?        Sl     0:00 /usr/lib/gvfs/gvfs-udisks2-volume-monitor
 2337 ?        Ssl    0:12 /usr/lib/udisks2/udisksd --no-debug
 2359 ?        S<     0:00 [krfcommd]
 2363 ?        S      0:00 /usr/bin/python3 /usr/bin/cinnamon-launcher
 2367 ?        Sl     0:00 /usr/lib/gvfs/gvfs-mtp-volume-monitor
 2372 ?        Sl     0:00 /usr/lib/gvfs/gvfs-gphoto2-volume-monitor
 2377 ?        Sl     0:00 /usr/lib/gvfs/gvfs-afc-volume-monitor
 2383 ?        Sl     0:00 /usr/lib/gvfs/gvfs-goa-volume-monitor
 2387 ?        Sl     0:25 /usr/lib/gnome-online-accounts/goa-daemon
 2388 ?        Sl    42:27 cinnamon --replace
 2483 ?        Sl     0:00 /usr/lib/gnome-online-accounts/goa-identity-service
 2577 ?        Sl     0:00 blueberry-obex-agent
 2578 ?        Sl     0:15 /usr/lib/caribou/caribou
 2586 ?        Sl     0:00 /usr/lib/policykit-1-gnome/polkit-gnome-authenticatio
 2587 ?        Sl     0:02 nemo-desktop
 2602 ?        S      0:00 /usr/lib/bluetooth/obexd
 2606 ?        Sl     1:52 nm-applet
 2609 ?        Sl     0:00 /usr/bin/python3 /usr/bin/cinnamon-killer-daemon
 2625 ?        S      0:00 /usr/bin/python3 /usr/bin/blueberry-tray
 2630 ?        S      0:00 sh -c /usr/lib/blueberry/blueberry-tray.py
 2631 ?        Sl     0:00 python2 /usr/lib/blueberry/blueberry-tray.py
 2632 ?        Sl     6:19 cinnamon-screensaver
 2639 ?        S      0:00 python2 /usr/lib/blueberry/safechild /usr/sbin/rfkill
 2642 ?        S      0:00 /usr/sbin/rfkill event
 2665 ?        Sl     0:00 /usr/lib/gvfs/gvfsd-metadata
 2705 ?        Sl     0:00 /usr/lib/gvfs/gvfsd-trash --spawner :1.22 /org/gtk/gv
 2735 ?        SLl   69:12 /opt/google/chrome/chrome
 2741 ?        S      0:00 cat
 2742 ?        S      0:00 cat
 2745 ?        S      0:00 /usr/bin/python3 /usr/bin/mintupdate-launcher
 2748 ?        S      0:00 sh -c /usr/lib/linuxmint/mintUpdate/mintUpdate.py
 2749 ?        Sl     0:01 mintUpdate
 2787 ?        S      0:00 /opt/google/chrome/chrome --type=zygote --enable-cras
 2795 ?        S      0:00 /opt/google/chrome/nacl_helper
 2798 ?        S      0:01 /opt/google/chrome/chrome --type=zygote --enable-cras
 2836 ?        Sl     0:01 /usr/bin/python3 /usr/share/system-config-printer/app
 2867 ?        Sl    20:00 /opt/google/chrome/chrome --type=gpu-process --field-
 2894 ?        S      0:00 /opt/google/chrome/chrome --type=-broker
 2911 ?        Sl     0:12 /opt/google/chrome/chrome --type=renderer --field-tri
 2964 ?        Sl     0:02 /opt/google/chrome/chrome --type=renderer --field-tri
 2988 ?        Sl     0:59 /opt/google/chrome/chrome --type=renderer --field-tri
 2995 ?        Sl     0:13 /opt/google/chrome/chrome --type=renderer --field-tri
 2996 ?        Sl     0:02 /opt/google/chrome/chrome --type=renderer --field-tri
 2997 ?        Sl     4:04 /opt/google/chrome/chrome --type=renderer --field-tri
 3001 ?        Sl     3:17 /opt/google/chrome/chrome --type=renderer --field-tri
 3032 ?        Sl     9:20 /opt/google/chrome/chrome --type=renderer --field-tri
 3169 ?        Sl     1:06 /opt/google/chrome/chrome --type=renderer --field-tri
 3199 ?        Sl     9:25 /opt/google/chrome/chrome --type=renderer --field-tri
 3259 ?        Sl     0:37 /opt/google/chrome/chrome --type=renderer --field-tri
 3298 ?        Sl     0:09 /opt/google/chrome/chrome --type=renderer --field-tri
 4309 ?        S      0:00 dbus-launch --autolaunch=bbada5cfcc9a4a80ac8dc5ce6d9f
 4311 ?        Ss     0:00 /usr/bin/dbus-daemon --fork --print-pid 5 --print-add
 4674 ?        Sl     0:10 nemo /home/john/Desktop/New folder
 4909 ?        Sl     0:51 /opt/google/chrome/chrome --type=renderer --field-tri
 5012 ?        S      0:00 /sbin/dhclient -d -q -sf /usr/lib/NetworkManager/nm-d
 5264 ?        Sl     0:29 /opt/google/chrome/chrome --type=renderer --field-tri
 6100 ?        Sl     0:00 /usr/lib/gvfs/gvfsd-network --spawner :1.22 /org/gtk/
 6121 ?        Sl     0:00 /usr/lib/gvfs/gvfsd-dnssd --spawner :1.22 /org/gtk/gv
 6299 ?        Sl     0:57 /opt/google/chrome/chrome --type=renderer --field-tri
 6320 ?        Sl    30:31 /opt/google/chrome/chrome --type=renderer --field-tri
 6333 ?        Sl     0:58 /opt/google/chrome/chrome --type=renderer --field-tri
 6349 ?        Sl     0:40 /opt/google/chrome/chrome --type=renderer --field-tri
 6419 ?        S      0:00 /usr/lib/x86_64-linux-gnu/gconf/gconfd-2
 6476 ?        I      0:00 [kworker/u8:3]
 6620 ?        I      0:00 [kworker/0:0]
 7109 ?        I<     0:00 [kworker/u9:3]
 7637 ?        Sl     0:04 /opt/google/chrome/chrome --type=renderer --field-tri
 8567 ?        Sl     5:11 /opt/google/chrome/chrome --type=renderer --field-tri
 8655 ?        I      0:00 [kworker/3:0]
 9176 ?        Sl    10:45 /opt/google/chrome/chrome --type=renderer --field-tri
 9685 ?        I      0:00 [kworker/2:10]
 9687 ?        I      0:00 [kworker/2:12]
 9688 ?        I      0:00 [kworker/2:13]
 9823 pts/1    Ss     0:00 bash
 9855 ?        D      0:00 [kworker/u8:2]
10298 ?        Sl    25:34 /opt/google/chrome/chrome --type=renderer --field-tri
10472 ?        I      0:00 [kworker/2:0]
10473 ?        I      0:00 [kworker/3:1]
10486 ?        I      0:00 [kworker/1:2]
10749 ?        I      0:00 [kworker/u8:1]
10872 ?        Sl     0:16 /opt/google/chrome/chrome --type=renderer --field-tri
10929 ?        Sl     0:00 /opt/google/chrome/chrome --type=renderer --field-tri
10956 ?        Sl    10:02 /opt/google/chrome/chrome --type=renderer --field-tri
11115 ?        Sl    17:48 /opt/google/chrome/chrome --type=renderer --field-tri
11279 ?        I      0:00 [kworker/3:2]
11305 ?        I      0:00 [kworker/0:2]
11342 ?        I      0:00 [kworker/2:1]
11375 ?        I      0:00 [kworker/1:0]
11393 ?        I      0:00 [kworker/3:3]
12019 ?        Sl     0:00 /opt/google/chrome/chrome --type=renderer --field-tri
12052 pts/1    R+     0:00 ps ax
14797 ?        Sl     0:41 /opt/google/chrome/chrome --type=renderer --field-tri
15010 ?        Sl    24:54 /opt/google/chrome/chrome --type=renderer --field-tri
16781 ?        Sl     0:29 /opt/google/chrome/chrome --type=renderer --field-tri
17262 ?        Sl     0:30 /opt/google/chrome/chrome --type=renderer --field-tri
17328 ?        Sl     0:01 /opt/google/chrome/chrome --type=renderer --field-tri
17764 ?        Sl     5:42 /opt/google/chrome/chrome --type=renderer --field-tri
18311 ?        Sl     0:41 /opt/google/chrome/chrome --type=renderer --field-tri
18356 ?        Sl     0:27 /opt/google/chrome/chrome --type=renderer --field-tri
19812 ?        Sl     0:02 /usr/lib/gnome-terminal/gnome-terminal-server
20352 ?        Sl    20:14 /opt/google/chrome/chrome --type=renderer --field-tri
21553 ?        Sl     0:06 /opt/google/chrome/chrome --type=renderer --field-tri
22403 ?        Sl     0:01 /opt/google/chrome/chrome --type=renderer --field-tri
23280 ?        Sl     0:00 /usr/lib/gvfs/gvfsd-http --spawner :1.22 /org/gtk/gvf
25070 ?        Ss     0:00 /usr/sbin/cupsd -l
25071 ?        Ssl    0:00 /usr/sbin/cups-browsed
29976 ?        I<     0:00 [kworker/u9:2]
30400 ?        S      0:00 [irq/48-mei_me]
john@lap-top ~ $ service apache2 start
john@lap-top ~ $ a2enmod rewrite userdir
ERROR: Module rewrite does not exist!
ERROR: Module userdir does not exist!

any thoughts? Thanks for your help
john

Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.

Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.

johnnya23

Level 1
Level 1
Posts: 48
Joined: Fri Mar 09, 2018 10:06 am

Re: Trying to install apache

Post

by johnnya23 » Tue Dec 18, 2018 5:04 pm

maybe I should have included this:

Code: Select all

john@lap-top ~ $ sudo apt-get install apache2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
apache2 is already the newest version (2.4.18-2ubuntu3.9).
0 upgraded, 0 newly installed, 0 to remove and 166 not upgraded.

User avatar

murray

Level 5
Level 5
Posts: 789
Joined: Tue Nov 27, 2018 4:22 pm
Location: Auckland, New Zealand

Re: Trying to install apache

Post

by murray » Tue Dec 18, 2018 5:42 pm

johnnya23 wrote: ↑

Tue Dec 18, 2018 5:03 pm


I got to this issue:

Code: Select all

john@lap-top ~ $ service apache2 start
john@lap-top ~ $ a2enmod rewrite userdir
ERROR: Module rewrite does not exist!
ERROR: Module userdir does not exist!

any thoughts? Thanks for your help
john

I found someone else that couldn’t activate the rewrite module. Maybe try what they did: https://sharadchhetri.com/2014/02/21/er … ite-exist/

Running Mint 19.3 Cinnamon on an Intel NUC8i5BEH with 16GB RAM and 500GB SSD

User avatar

PhilippeH

Level 2
Level 2
Posts: 84
Joined: Thu Jul 20, 2017 3:12 am
Location: Toulon (France)
Contact:

Re: Trying to install apache

Post

by PhilippeH » Wed Dec 19, 2018 1:11 pm

For mod_rewrite, you have to activate it in httpd.conf configuration file, for example :

Code: Select all

LoadModule rewrite_module modules/mod_rewrite.so

johnnya23

Level 1
Level 1
Posts: 48
Joined: Fri Mar 09, 2018 10:06 am

Re: Trying to install apache

Post

by johnnya23 » Wed Dec 19, 2018 8:34 pm

I see this in terminal:
john@lap-top ~ $ sudo apt-get install apache2
[sudo] password for john:
Reading package lists… Done
Building dependency tree
Reading state information… Done
apache2 is already the newest version (2.4.18-2ubuntu3.9).
0 upgraded, 0 newly installed, 0 to remove and 165 not upgraded.

which I guess is telling me that apache is installed, but no apache folder and no http.conf, so not sure what is happening.

reaper_6

Re: Trying to install apache

Post

by reaper_6 » Wed Dec 19, 2018 11:42 pm

/etc/apache2/httpd.conf
/etc/apache2/apache2.conf
/etc/httpd/httpd.conf
/etc/httpd/conf/httpd.conf

These are the standard locations for apache .conf files if they are not /etc/apache2 check /etc/httpd

johnnya23

Level 1
Level 1
Posts: 48
Joined: Fri Mar 09, 2018 10:06 am

Re: Trying to install apache

Post

by johnnya23 » Thu Dec 20, 2018 10:23 am

Not seeing it:
john@lap-top ~ $ man find httpd.conf
No manual entry for httpd.conf
john@lap-top ~ $ find httpd.conf
find: ‘httpd.conf’: No such file or directory

sgtor

Level 4
Level 4
Posts: 332
Joined: Sat May 13, 2017 9:39 pm

Re: Trying to install apache

Post

by sgtor » Thu Dec 20, 2018 1:48 pm

johnnya23 wrote: ↑

Thu Dec 20, 2018 10:23 am


Not seeing it:
john@lap-top ~ $ man find httpd.conf
No manual entry for httpd.conf
john@lap-top ~ $ find httpd.conf
find: ‘httpd.conf’: No such file or directory

your syntax is wrong for the find. You need to add a directory and a option to it like this. -lname = option to show case insensitive filename
if you wanted to search the entire computer which would take a long time it would be this.

That being said I would not do it that way all. You should try locate instead it’s much easier and faster.

And to see what parts of apache are actually installed or not you can run this.

/etc has all the config files so you can also run this to see where everything with apache in it is.

johnnya23

Level 1
Level 1
Posts: 48
Joined: Fri Mar 09, 2018 10:06 am

Re: Trying to install apache

Post

by johnnya23 » Thu Dec 27, 2018 11:41 am

I get:

Code: Select all

find /etc | grep apache | less

/etc/ufw/applications.d/apache2
/etc/ufw/applications.d/apache2-utils.ufw.profile
/etc/rc3.d/S02apache2
/etc/rc3.d/K01apache-htcacheclean
/etc/rc4.d/S02apache2
/etc/rc4.d/K01apache-htcacheclean
/etc/logrotate.d/apache2
/etc/apparmor.d/abstractions/apache2-common
/etc/init.d/apache2
/etc/init.d/apache-htcacheclean
/etc/default/apache-htcacheclean
/etc/rc6.d/K01apache-htcacheclean
/etc/rc6.d/K01apache2
/etc/rc5.d/S02apache2
/etc/rc5.d/K01apache-htcacheclean
/etc/rc0.d/K01apache-htcacheclean
/etc/rc0.d/K01apache2
/etc/rc2.d/S02apache2
/etc/rc2.d/K01apache-htcacheclean
/etc/rc1.d/K01apache-htcacheclean
/etc/rc1.d/K01apache2
/etc/php/7.0/apache2
/etc/php/7.0/apache2/conf.d
/etc/cron.daily/apache2
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
(END)

before I terminate maually, the others are not particularly helpful either.
(and have to be terminated by closing terminal — after up to a half hour).
and:

Code: Select all

john@lap-top ~ $ apt search apache | grep ^i
i   apache2                         - Apache HTTP Server                        
i   apache2-bin                     - Apache HTTP Server (modules and other bina
i   apache2-data                    - Apache HTTP Server (common files)         
i   apache2-utils                   - Apache HTTP Server (utility programs for w

sgtor

Level 4
Level 4
Posts: 332
Joined: Sat May 13, 2017 9:39 pm

Re: Trying to install apache

Post

by sgtor » Thu Dec 27, 2018 6:28 pm

I think you’re getting confused with the less command. The results are being piped through the less command and that shows results page by page. You can use up and down arrow keys or page up and page down keys.

The only one that would take so long that you would want to terminate it is the first one I mentioned which I did say would take too long and don’t bother doing it. I was just using it as an example of proper find command syntax.

This is kind of odd, when you install apache everything including config files also get installed. And apache2 is supposed to use apache.conf not httpd.conf. For the hell of it though run this.

and this

I wonder if you deleted some folders by mistake while trying to get it all to work. It’s also possible that if you had an old version that used httpd.conf it prevented apache.conf from being installed, that would be a bug/feature depending on a persons situation. I don’t know the code of apache though so it’s just a theory. whereis apache2 will tell us what we need to know.

johnnya23

Level 1
Level 1
Posts: 48
Joined: Fri Mar 09, 2018 10:06 am

Re: Trying to install apache

Post

by johnnya23 » Fri Dec 28, 2018 10:52 am

I get:
john@lap-top ~ $ sudo find /etc | grep httpd
john@lap-top ~ $ whereis apache
apache:
john@lap-top ~ $

so, nothing I guess?

Is there any way I should «scrub» whatever might be there and reinstall apache?
thanks,
John

sgtor

Level 4
Level 4
Posts: 332
Joined: Sat May 13, 2017 9:39 pm

Re: Trying to install apache

Post

by sgtor » Fri Dec 28, 2018 3:15 pm

johnnya23 wrote: ↑

Fri Dec 28, 2018 10:52 am


I get:
john@lap-top ~ $ sudo find /etc | grep httpd
john@lap-top ~ $ whereis apache
apache:
john@lap-top ~ $

so, nothing I guess?

Is there any way I should «scrub» whatever might be there and reinstall apache?
thanks,
John

Try

not apache but apache2

sgtor

Level 4
Level 4
Posts: 332
Joined: Sat May 13, 2017 9:39 pm

Re: Trying to install apache

Post

by sgtor » Fri Dec 28, 2018 3:20 pm

johnnya23 wrote: ↑

Fri Dec 28, 2018 10:52 am



Is there any way I should «scrub» whatever might be there and reinstall apache?
thanks,
John

And yeah if you wanted to just go ahead and do that copy and paste this.

Code: Select all

sudo apt purge -y apache2
sudo apt install -y apache2

Then see if it created apache2 directory

User avatar

phd21

Level 20
Level 20
Posts: 10100
Joined: Thu Jan 09, 2014 9:42 pm
Location: Florida

Re: Trying to install apache

Post

by phd21 » Fri Dec 28, 2018 4:14 pm

Hi johnnya23,

I just read your post and the good replies to it. Here are my thoughts on this as well.

FYI: This recent post has links on installing Apache web server
Total noob — Linux Mint Forums
viewtopic.php?f=180&t=284412

Hope this helps …

Phd21: Mint 20 Cinnamon & xKDE (Mint Xfce + Kubuntu KDE) & KDE Neon 64-bit (new based on Ubuntu 20.04) Awesome OS’s, Dell Inspiron I5 7000 (7573) 2 in 1 touch screen, Dell OptiPlex 780 Core2Duo E8400 3GHz,4gb Ram, Intel 4 Graphics.

johnnya23

Level 1
Level 1
Posts: 48
Joined: Fri Mar 09, 2018 10:06 am

Re: Trying to install apache

Post

by johnnya23 » Fri Jan 11, 2019 11:24 am

ok, purged and reinstalled apache got rewrite and userdir enabled, I restarted apache and now I was hoping that a file at /home/john/public_html (index.html) would display at http://localhost/john, but localhost is still pointed to /var/www/html/
thx

User avatar

kukamuumuka

Level 16
Level 16
Posts: 6735
Joined: Tue Sep 03, 2013 4:51 am
Location: Finland
Contact:

Re: Trying to install apache

Post

by kukamuumuka » Fri Jan 11, 2019 2:26 pm

johnnya23 wrote: ↑

Fri Jan 11, 2019 11:24 am


ok, purged and reinstalled apache got rewrite and userdir enabled, I restarted apache and now I was hoping that a file at /home/john/public_html (index.html) would display at http://localhost/john, but localhost is still pointed to /var/www/html/
thx

Make a symbolic link.

Code: Select all

sudo ln -s /home/john /var/www/html

https://puolanka.info/goto/apache-and-p … d-mint-19/

PS. I suppose that you want the link for public_html. If so, it goes

Code: Select all

mkdir -p /home/john/public_html/john
sudo ln -s /home/john/public_html/john /var/www/html

PS2. Remove the first link first if using the second option.

johnnya23

Level 1
Level 1
Posts: 48
Joined: Fri Mar 09, 2018 10:06 am

Re: Trying to install apache

Post

by johnnya23 » Fri Jan 11, 2019 5:06 pm

after:
john@lap-top ~ $ mkdir -p /home/john/public_html/websites
john@lap-top ~ $ sudo ln -s /home/john/public_html/websites /var/www/html
john@lap-top ~ $ sudo unlink /var/www/html/john

at:
http://localhost/

iget:
This site can’t be reached localhost refused to connect.
Did you mean http://locallhost.com/?
Search Google for localhost
ERR_CONNECTION_REFUSED

thanks for all your help,
JOhn

User avatar

kukamuumuka

Level 16
Level 16
Posts: 6735
Joined: Tue Sep 03, 2013 4:51 am
Location: Finland
Contact:

Re: Trying to install apache

Post

by kukamuumuka » Fri Jan 11, 2019 5:10 pm

Option 2 is:

Code: Select all

mkdir -p /home/john/public_html/websites
sudo ln -s /home/john/public_html/websites /var/www/html

PS. Are you into www-data group?

Code: Select all

sudo usermod -a -G www-data your_username_here
sudo chgrp -R www-data /var/www/html
sudo chmod -R g+w /var/www/html

Комментарии

Альтен Кобург

04.10.2010
09:11

Постоянная ссылка на комментарийПостоянная ссылка на комментарий

+1

Войдите, чтобы ставить лайкимне нравится

Спасибо! Как раз вчера искал почему пуст httpd.conf

ras0ft

13.10.2015
22:09

Постоянная ссылка на комментарийПостоянная ссылка на комментарийРодительский комментарийРодительский комментарий

+1

Войдите, чтобы ставить лайкимне нравится

Првиет, у меня после обновы, отвалилсся ЧПУ на сервере — попробовал настроить не работает ну никак. и htaccess обновлял, и вордпресс обновил, и mod-rewrite вручную перезапускал командами, хрен там.

захожу на linux4home.ru и не пускает ни на /video никуда.

бывало не?

allowoverride All естественно делал. a2enmod разумеется тоже делал. и сервер конечно же перезапускал. разве только что молотком по нему бить не пробовал.

Денис Радченко

04.10.2010
15:37

Постоянная ссылка на комментарийПостоянная ссылка на комментарий

+1

Войдите, чтобы ставить лайкимне нравится

А чем вам не нравится sudo a2enmod rewrite ?

yuriy

Активный пользователь

Активный

04.10.2010
16:42

Постоянная ссылка на комментарийПостоянная ссылка на комментарийРодительский комментарийРодительский комментарий

+1

Войдите, чтобы ставить лайкимне нравится

Нравится, хорошая штука. Фактически она выполняет ln -s ../mods-available/rewrite.load rewrite.load
Я просто описал более ‘низкоуровневый’ метод.

Максим

07.10.2017
01:34

Постоянная ссылка на комментарийПостоянная ссылка на комментарийРодительский комментарийРодительский комментарий

+1

Войдите, чтобы ставить лайкимне нравится

«низкоуровневый» подход не сработал.

Anrew

14.05.2020
15:54

Постоянная ссылка на комментарийПостоянная ссылка на комментарийРодительский комментарийРодительский комментарий

+1

Войдите, чтобы ставить лайкимне нравится

А у меня все сработало на LAMP в Ubuntu

Akellacom

Активный пользователь

Активный

15.10.2010
21:14

Постоянная ссылка на комментарийПостоянная ссылка на комментарий

+1

Войдите, чтобы ставить лайкимне нравится

Спасибо! как раз искал, в чем проблема была с ЧПУ, оказывается совсем забыл про замену AllowOverride None на AllowOverride All :)

Отличный ресурс!

batan

03.11.2010
22:02

Постоянная ссылка на комментарийПостоянная ссылка на комментарий

+1

Войдите, чтобы ставить лайкимне нравится

спс! статья спасла мне жизнь!))

deburger

Активный пользователь

Активный

05.01.2011
19:15

Постоянная ссылка на комментарийПостоянная ссылка на комментарий

+1

Войдите, чтобы ставить лайкимне нравится

Спасибо!

bussel

18.02.2011
10:44

Постоянная ссылка на комментарийПостоянная ссылка на комментарий

+1

Войдите, чтобы ставить лайкимне нравится

Даже не знаю, как благодарить автора этой статьи. Три дня на вновь установленном LAMP я не мог добиться, чтобы мой сайт открывал внутренние страницы. Еле-еле до меня дошло, что дело тут кроется в ЧПУ. Потом еще долго ковырялся в догадках, почему, собственно, они не открываются, так как с линками по умолчанию все работало. Наконец, прочитав эту статью, я понял, что просто-напросто у меня в apache не активирован mod_rewrite, а также, как его заставить работать. Огромнейшее спасибо!!!

Dark

07.03.2011
17:21

Постоянная ссылка на комментарийПостоянная ссылка на комментарий

+1

Войдите, чтобы ставить лайкимне нравится

Огромное спасибо! Файл httpd.conf был пустой, не знал что делать, а тут всё так просто оказывается. Спасибо!

Василий

14.05.2011
12:43

Постоянная ссылка на комментарийПостоянная ссылка на комментарий

+1

Войдите, чтобы ставить лайкимне нравится

Рельно помогло. бился аж 6 часов — оказалось:
— apache2ctl restart
обязательная запись. внес ее сначала в default. а затем в виртуальные хосты. СПАСИБО И РЕСПЕКТ
… p.s. блин вчера лег спать в пять утра из-за этой доблабнной настройки. ну думал ваще пипец…

Юрий Изотов

10.07.2011
10:17

Постоянная ссылка на комментарийПостоянная ссылка на комментарий

+1

Войдите, чтобы ставить лайкимне нравится

Вообще в убунте для включения сайтов есть утила a2ensite (соотв. для отключения оных a2dissite), то есть в убунте после создания /etc/apache2/sites-available/crocodilus , надо просто сделать:
sudo a2ensite crocodilus
А чтобы включить mod_rewrite надо сделать:
sudo a2enmod rewrite
и после этого прога предложит перезапустить Апач.
Итого нет мороки с символьными ссылками. Удобно.

Voland

Активный пользователь

Активный

13.07.2011
10:15

Постоянная ссылка на комментарийПостоянная ссылка на комментарийРодительский комментарийРодительский комментарий

+1

Войдите, чтобы ставить лайкимне нравится

Удобно, только далеко не везде убунту, и знать не убунтушные методы надо. Нужно ведь уметь с линукс работать, а не только с убунту.

[аноним]

07.03.2018
16:39

Постоянная ссылка на комментарийПостоянная ссылка на комментарийРодительский комментарийРодительский комментарий

+1

Войдите, чтобы ставить лайкимне нравится

А убунту — это что по твоему?

VadimAndy

Активный пользователь

Активный

08.03.2018
18:03

Постоянная ссылка на комментарийПостоянная ссылка на комментарийРодительский комментарийРодительский комментарий

+1

Войдите, чтобы ставить лайкимне нравится

ubuntu — не Linux, если что =))

Alex

04.08.2011
01:01

Постоянная ссылка на комментарийПостоянная ссылка на комментарий

+1

Войдите, чтобы ставить лайкимне нравится

Спасибо за ресурс!

Anton

29.08.2011
21:47

Постоянная ссылка на комментарийПостоянная ссылка на комментарий

+1

Войдите, чтобы ставить лайкимне нравится

Делал для winlock. ЧПУ на вордпрессе пол ночи! СПАСИБО ЗА sudo a2enmod rewrite ВСЕ НАМНОГО ПРОЩЩЕ!!!

Den

16.12.2011
03:17

Постоянная ссылка на комментарийПостоянная ссылка на комментарий

+1

Войдите, чтобы ставить лайкимне нравится

Спасибо за подсказку. Голову сломал

Александр Асланьян

05.01.2012
13:12

Постоянная ссылка на комментарийПостоянная ссылка на комментарий

+1

Войдите, чтобы ставить лайкимне нравится

Большое спасибо за ответ. Ковыряюсь с установкой cms newscoop. Напишу сегодня у себя в жж пост про установку на виртуальный сервер и работу с этой cms. Если интересно: http://aslanalexander.livejournal.com/

Евгений Тимочкин

21.10.2012
13:55

Постоянная ссылка на комментарийПостоянная ссылка на комментарий

+1

Войдите, чтобы ставить лайкимне нравится

Спасибо за совет. Опишу ситуацию. На сервере стоит апач, на нем крутится 2 сайта. Допустим site1.ru и site2.ru. Виртуальные хосты я настроил, оба сайта видны. В cms MODx Revolution включаю ЧПУ. Все по инструкции, в файле .htacces включаю RewriteEngine On и RewriteBase /. И ничего не работает… Сначала я наткнулся на AllowOverride None в настройках. Исправил. Теперь вместо ошибки 404 я получаю ошибку 500. Не подскажете в чем может быть затык? Заранее благодарен.

Voland

Активный пользователь

Активный

22.10.2012
16:03

Постоянная ссылка на комментарийПостоянная ссылка на комментарийРодительский комментарийРодительский комментарий

+1

Войдите, чтобы ставить лайкимне нравится

А сам модуль mod_rewrite апачем подгружен?

gst

08.01.2013
23:59

Постоянная ссылка на комментарийПостоянная ссылка на комментарий

+1

Войдите, чтобы ставить лайкимне нравится

благодарствую за статью

Иван Рогов

07.04.2013
12:17

Постоянная ссылка на комментарийПостоянная ссылка на комментарий

+1

Войдите, чтобы ставить лайкимне нравится

Спасибо дружище! Два дня сидел разбирался чегож у меня ЧПУ не работают!!!:)

sasser

10.05.2013
13:01

Постоянная ссылка на комментарийПостоянная ссылка на комментарий

+1

Войдите, чтобы ставить лайкимне нравится

Тоже лайкаю автору. Описано всё коротко и ясно. Долго не мог понять почему у меня в связке Ubuntu + LAMP + MODX не работают ЧПУ. Затем докопал что должен быть подключен в apache модуль rewrite и погуглив «apache2 установить модуль mod_rewrite» нашел эту замечательную статью. Одна минута и всё работает.

Hanma Baki

05.03.2015
23:14

Постоянная ссылка на комментарийПостоянная ссылка на комментарий

+1

Войдите, чтобы ставить лайкимне нравится

Мне статья, тоже помогла! Большое спасибо! Главная страница грузилась, а при переходе по ссылкам сервер выдавал ошибку 404. Осталась одно, не выводятся картинки, которые заданы фоновым изображением в стилях css, типа background (../image1.png). Видимо, где-то опять Апачь шалит…

DonnaGib

20.04.2017
20:05

Постоянная ссылка на комментарийПостоянная ссылка на комментарий

+1

Войдите, чтобы ставить лайкимне нравится

как открыть файл docx ?

Forsazhe

28.04.2017
08:40

Постоянная ссылка на комментарийПостоянная ссылка на комментарийРодительский комментарийРодительский комментарий

+1

Войдите, чтобы ставить лайкимне нравится

Обычным вордом из офиса 2013 к примеру.

VadimAndy

Активный пользователь

Активный

04.09.2017
16:34

Постоянная ссылка на комментарийПостоянная ссылка на комментарийРодительский комментарийРодительский комментарий

+1

Войдите, чтобы ставить лайкимне нравится

молча либр это делает как 2 пальца обоссать

BrianWaf

03.09.2017
20:25

Постоянная ссылка на комментарийПостоянная ссылка на комментарий

+1

Войдите, чтобы ставить лайкимне нравится

Комп не видит диск SDD подскажите как решить проблему

Максим

30.10.2017
22:06

Постоянная ссылка на комментарийПостоянная ссылка на комментарий

+1

Войдите, чтобы ставить лайкимне нравится

Спасибо Вам большое! Добра Вам да побольше! Вы мне очень помогли, я Вам очень благодарен. Спасибо.
Пользуюсь Debian 9

Andrew

14.05.2020
16:01

Постоянная ссылка на комментарийПостоянная ссылка на комментарий

+1

Войдите, чтобы ставить лайкимне нравится

Статья помогла и проблема решилась — спасибо автору! Единственное, что добавил

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>

в конфиг виртуального хоста непосредственно

Иногда люди сталкиваются с проблемой —  сервер apache не читает ваш файл .htaccess или apache не переписывает URL, а мы используем правильные правила перезаписи в конфигурационных файлах. Это происходит из-за того, что модуль rewrite не включен в apache. Т.к модуль mod_rewrite не включен по умолчанию на сервер, поэтому для использования rewrite, нужно вручную включить mode_rewrite. В моей статье «Включить модуль mod_rewrite для Apache в Debian/Ubuntu»  я расскажу как я это могу сделать.

1. Включение модуля mod_rewrite в Apache2

Для этого, я использую команду «a2enmod», чтобы включить любые модули в веб-сервере Apache 2. Так что, используйте следующую команду чтобы включить mod_rewrite модуль для apache:

$ sudo a2enmod rewrite

2. Активировать ReWrite в вирутальном хосте

После включения модуля ReWrite для Apache необходимо добавить «AllowOverride All» в вашем файле конфигурации для виртуального хоста. Этот параметр также может быть включен в глобальном масштабе, путем редактирования основного файла конфигурации apache:

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
</Directory>

3. Перезапуск конфигурации Apache2

После включения модуля mod_rewrite  для Apache нужно перезагрузить сервер Apache2:

# service apache2 restart

Тема «Включить модуль mod_rewrite для Apache в Debian/Ubuntu» завершена.

  • Архив новостей

    Архив новостей

  • Свежие записи

    • Pull/Push AWS ECR образов через AWS Route53 CNAME
      17.11.2021
    • openpgp: signature made by unknown entity в Terraform
      09.11.2021
    • Установка Terraformer в Unix/Linux
      31.05.2021
    • Установка ArgoCD в Unix/Linux
      06.01.2021
    • Установка tfswitch в Unix/Linux
      08.12.2020
  • Мета

    • Войти
    • Лента записей
    • Лента комментариев
    • WordPress.org

1572 / 643 / 79

Регистрация: 24.02.2009

Сообщений: 9,268

1

Переадресация

17.03.2010, 22:46. Показов 8376. Ответов 38


Как сделать так, чтобы при вводе в адресной строке браузера, например, http://mysite.com/id1 перенаправлялось на http://mysite.com/vp.php?id=1, а в адресной строке отображалось http://mysite.com/id1 ?



0



Programming

Эксперт

94731 / 64177 / 26122

Регистрация: 12.04.2006

Сообщений: 116,782

17.03.2010, 22:46

Ответы с готовыми решениями:

Переадресация
Всем привет.
Ребят помогите пожалуйста с переадресацией с одного домена на другой, чтобы к примеру…

Переадресация
Добрый день

Помогите сделать редирект спомощью httacess

с http://site.ru/page1 на…

Переадресация
Друзья, не особо силен в апаче, но есть небольшая задачка.
Есть сайт frontend и backend частью…

Переадресация
Здравствуйте. Пишу сервис коротких ссылок.
Есть страницы:
index.php
oauth.php
goto.php
Надо…

38

390 / 229 / 11

Регистрация: 09.12.2009

Сообщений: 668

18.03.2010, 14:45

2

RewriteEngine on
RewriteRule ^/id([0-9]+)/$ vp.php?id=$1 [L]



2



1572 / 643 / 79

Регистрация: 24.02.2009

Сообщений: 9,268

21.03.2010, 21:21

 [ТС]

3

Либо скрипт неправильный, либо я что-то настроил неправильно, либо настройки сервера странные.
Сначала (потом, почему-то, этой проблемы уже не было):

Код

[Thu Mar 18 22:08:03 2010] [alert] [client 192.168.0.100] /var/www/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration

И сегодня:

Код

[Sun Mar 21 23:02:42 2010] [alert] [client 192.168.0.100] /var/www/.htaccess: Invalid command 'AddModule', perhaps misspelled or defined by a module not included in the server configuration

,
когда решил сделать так:

Код

AddModule mod_rewrite.с
RewriteEngine on
RewriteRule ^/id([0-9]+)/$ vp.php?v=$1 [L]

всё это время пытался разобраться с проблемой, не получилось.

PS. Если не прописывать «AddModule mod_rewrite.с», то ошибок нет, но скрипт не работает



0



390 / 229 / 11

Регистрация: 09.12.2009

Сообщений: 668

21.03.2010, 21:53

4

У тебя в апаче не установлен mod_rewrite



0



1572 / 643 / 79

Регистрация: 24.02.2009

Сообщений: 9,268

21.03.2010, 22:06

 [ТС]

5

Цитата
Сообщение от SunDrop
Посмотреть сообщение

У тебя в апаче не установлен mod_rewrite

mod_rewrite.so есть. Он вроде говорит про то, что не знает команду «AddModule»



0



390 / 229 / 11

Регистрация: 09.12.2009

Сообщений: 668

22.03.2010, 02:24

6

Записи AddModule в 2.0.х исключены — нужно подключать LoadModule mod_rewrite.so



1



1572 / 643 / 79

Регистрация: 24.02.2009

Сообщений: 9,268

22.03.2010, 10:31

 [ТС]

7

Цитата
Сообщение от SunDrop
Посмотреть сообщение

LoadModule mod_rewrite.so

[Mon Mar 22 12:26:37 2010] [alert] [client 192.168.0.100] /var/www/.htaccess: LoadModule not allowed here



0



Эксперт по компьютерным сетямЭксперт NIX

12384 / 7223 / 758

Регистрация: 09.09.2009

Сообщений: 28,185

22.03.2010, 16:54

8

Так может в конфиге апача не хватает
AllowOverride All



1



1572 / 643 / 79

Регистрация: 24.02.2009

Сообщений: 9,268

22.03.2010, 18:35

 [ТС]

9

Цитата
Сообщение от dmkhn
Посмотреть сообщение

Так может в конфиге апача не хватает
AllowOverride All

это я указывал… в /etc/apache2/sites-available/default



0



Эксперт по компьютерным сетямЭксперт NIX

12384 / 7223 / 758

Регистрация: 09.09.2009

Сообщений: 28,185

22.03.2010, 19:11

11

а где-нибудь в районе параметра
defaultroot
?

Добавлено через 1 минуту

Цитата
Сообщение от Vovan-VE
Посмотреть сообщение

LoadModule может находиться только в httpd.conf

в убунту там пусто…

Добавлено через 1 минуту
когда-то на сайте вордпресса (в кодексе) находил целую страницу по поводу того, что и где нужно попроверять, если не работает мод-реврайт…



0



1572 / 643 / 79

Регистрация: 24.02.2009

Сообщений: 9,268

22.03.2010, 19:43

 [ТС]

12

Цитата
Сообщение от Vovan-VE
Посмотреть сообщение

LoadModule может находиться только в httpd.conf

в Ubuntu httpd.conf заменён apache2.conf, который отличается настройками



0



1572 / 643 / 79

Регистрация: 24.02.2009

Сообщений: 9,268

24.03.2010, 12:15

 [ТС]

13

Цитата
Сообщение от dmkhn
Посмотреть сообщение

а где-нибудь в районе параметра
defaultroot

это где? в /etc/apache2/apache2.conf и /etc/apache2/sites-available/default не нашёл



0



Эксперт по компьютерным сетямЭксперт NIX

12384 / 7223 / 758

Регистрация: 09.09.2009

Сообщений: 28,185

24.03.2010, 12:33

14

Сорри, склероз! Правильно —
documentroot
и еще. Вот тут (я уже писал ранее) можно в конце глянуть — там есть чуток про «мод реврайт рне работает»:
http://codex.wordpress.org/Using_Permalinks



1



1572 / 643 / 79

Регистрация: 24.02.2009

Сообщений: 9,268

24.03.2010, 13:29

 [ТС]

15

Цитата
Сообщение от dmkhn
Посмотреть сообщение

documentroot

Код

DocumentRoot /var/www
	<Directory />
		Options FollowSymLinks
		AllowOverride All
	</Directory>
	<Directory /var/www/>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride All
		Order allow,deny
		allow from all
	</Directory>



0



Эксперт по компьютерным сетямЭксперт NIX

12384 / 7223 / 758

Регистрация: 09.09.2009

Сообщений: 28,185

24.03.2010, 13:43

16

блин, вспомнил где-то инструкцию к убунте (где не помню). Видел там команду
a2enmod
или
a2enmode
если ввести ее пустую, вроде как выводит список доступных к включению модулей, уж не помню, как там выбирать, но потом можно просто ввести
a2enmod имя_модуля
ну или
a2enmode имя_модуля
(просто говорю ж не помню, какая команда правильная)



1



1572 / 643 / 79

Регистрация: 24.02.2009

Сообщений: 9,268

24.03.2010, 14:01

 [ТС]

17

судя по всему, этого модуля нет нет

Код

root@vladiator:~# a2enmod
Your choices are: actions alias asis auth_basic auth_digest auth_mysql authn_alias authn_anon authn_dbd authn_dbm authn_default authn_file authnz_ldap authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cern_meta cgi cgid charset_lite dav dav_fs dav_lock dbd deflate dir disk_cache dump_io env expires ext_filter file_cache filter headers ident imagemap include info ldap log_forensic mem_cache mime mime_magic negotiation php5 proxy proxy_ajp proxy_balancer proxy_connect proxy_ftp proxy_http rewrite setenvif speling ssl status substitute suexec unique_id userdir usertrack version vhost_alias
Which module(s) do you want to enable (wildcards ok)?
mod_rewrite
ERROR: Module mod_rewrite does not exist!

хотя я видел mod_rewrite.so



0



Эксперт по компьютерным сетямЭксперт NIX

12384 / 7223 / 758

Регистрация: 09.09.2009

Сообщений: 28,185

24.03.2010, 14:15

18

Ну вот и нашлась причина-то! Теперь нужно в инсталятор (например в синаптик) найти модуль, вставить птицу, и вперед!…



0



1572 / 643 / 79

Регистрация: 24.02.2009

Сообщений: 9,268

24.03.2010, 23:36

 [ТС]

19

Цитата
Сообщение от dmkhn
Посмотреть сообщение

Ну вот и нашлась причина-то! Теперь нужно в инсталятор (например в синаптик) найти модуль, вставить птицу, и вперед!…

теперь просто тот скрипт не работает… или я установил что-то не то

Переадресация



0



390 / 229 / 11

Регистрация: 09.12.2009

Сообщений: 668

25.03.2010, 00:41

20

Проверка работы mod_rewrite:

1) Проверяем файл «error.log» на наличие ошибок вида:
«Invalid command ‘RewriteEngine’, perhaps mis-spelled or defined by a module not included in the server configuration».

2) Проверяем базовый пример №1 — Запрет доступа к .htaccess

Код

RewriteEngine on
Options +FollowSymlinks
RewriteBase /
RewriteRule ^.htaccess$ - [F]

Второй базовый пример — Запрет доступа EmailSiphon к сайту:

Код

RewriteEngine on
Options +FollowSymlinks
RewriteBase /
RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon
RewriteRule ^.*$ - [F]

Третий базовый пример — Переадресация роботса на тестовый скрипт:

Код

RewriteEngine on
Options +FollowSymlinks
RewriteBase /
RewriteRule ^robots.txt$ /index.php?%{REQUEST_URI}

Если указанные примеры работают без ошибок, значит mod_rewrite установлен нормально и работает. В тестовом скрипте можно просто выполнить print_r($_GET)



1



I’m trying to get a PHP routing library set up. They give this example for a .htaccess file:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]

I couldn’t get this to work, so I tried enabling mod_rewrite, but it says «Module rewrite already enabled».

Why is it not working properly? Thanks!
I’m running Ubuntu Precise 12.04, and apache2.2.22. (Checked for any updates)

EDIT: A couple more details, it’s a PuPHPet vagrant build, rewrite should be enabled.

asked Feb 17, 2014 at 10:56

Freddy Heppell's user avatar

You need to allow the overwrite.

<Directory "/path/to/document/root/">
  AllowOverride All

</Directory>

user162687's user avatar

answered Feb 17, 2014 at 11:49

Evenbit GmbH's user avatar

Evenbit GmbHEvenbit GmbH

4,5184 gold badges22 silver badges33 bronze badges

1

First of all, set your httpd configuration to this (the path may differ with one another. In my ubuntu it’s placed at /etc/apache2/sites-available/default):

DocumentRoot /var/www

<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    Order allow,deny
    allow from all
</Directory>

After that, you should enable mod_rewrite with this command:

sudo a2enmod rewrite

The last one, restart your apache service:

sudo service apache2 restart

To ensure that, you can check it again from phpinfo in Configuration > apache2handler > Loaded Modules there must be written mod_rewrite and it means mod_rewrite is enabled.

answered May 14, 2014 at 4:38

metamorph's user avatar

metamorphmetamorph

1,63314 silver badges14 bronze badges

2

I had the similar problem, but the other answers did not helped me. This line at the begining of .htaccess solved my problem:

Options +FollowSymLinks -MultiViews

answered Aug 28, 2018 at 18:39

Damjan Pavlica's user avatar

1

My problem was that I didn’t have RewriteEngine on set early on in the file.

<VirtualHost *:80>
        ServerName &URL&
        ServerAlias *.&URL&

        ServerAdmin &EMAIL_ADDRESS&

        DocumentRoot            /var/www/&URL&/public

        RewriteEngine on

        # LogLevel: Control the severity of messages logged to the error_log.
        # Available values: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the log level for particular modules, e.g.
        # "LogLevel info ssl:warn"
        LogLevel                debug

        ErrorLog                /var/www/&URL&/storage/logs/apache2_error.log
        TransferLog             /var/www/&URL&/storage/logs/apache2_transfer.log

        <FilesMatch ".(cgi|html|php)$">
                SSLOptions +StdEnvVars
        </FilesMatch>

        # <------------  Here I used to have `RewriteEngine on`

        # Handle Front Controller...
        RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
        RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
        RewriteRule ^ /index.php [L,QSA]

</VirtualHost>

I dont know why but it helped when I placed RewriteEngine on higher up.

answered May 10, 2021 at 18:37

Daniel Katz's user avatar

Edit: I am pretty sure my .htaccess file is NOT being executed, and the problem is NOT with my rewrite rules.

I have not having any luck getting my .htaccess with mod_rewrite working. Basically all I am trying to do is remove ‘www’ from «http://www.site.com» and «https://www.site.com».

If there is anything I am missing (conf files, etc let me know I willl update this)

I jsut can’t see whats wrong here… I am using a 1&1 VPS III Virtual private server… anyone ever have this issue?

I am using Ubuntu 8.04 Server LTS.

Here is my .htaccess file (located @ /var/www/site/trunk/html/)

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.(.*) [NC]
RewriteRule (.*) //%1/$1 [L,R=301]

My mod_rewrite is enabled:

The auto regenerated sym link is there in mods-available and /usr/lib/apache2/modules/ contains mod_rewrite.so

root@s15348441:/etc/apache2/mods-available# more rewrite.load
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so


root@s15348441:/var/log# apache2ctl -t -D DUMP_MODULES
Loaded Modules:
 core_module (static)
 log_config_module (static)
 logio_module (static)
 mpm_prefork_module (static)
 http_module (static)
 so_module (static)
 alias_module (shared)
 auth_basic_module (shared)
 authn_file_module (shared)
 authz_default_module (shared)
 authz_groupfile_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 cgi_module (shared)
 dir_module (shared)
 env_module (shared)
 mime_module (shared)
 negotiation_module (shared)
 php5_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 ssl_module (shared)
 status_module (shared)
Syntax OK

My apache config files:

apache2.conf

#
# Based upon the NCSA server configuration files originally by Rob McCool.
#
# This is the main Apache server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See http://httpd.apache.org/docs/2.2/ for detailed information about
# the directives.
#
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned.  
#
# The configuration directives are grouped into three basic sections:
#  1. Directives that control the operation of the Apache server process as a
#     whole (the 'global environment').
#  2. Directives that define the parameters of the 'main' or 'default' server,
#     which responds to requests that aren't handled by a virtual host.
#     These directives also provide default values for the settings
#     of all virtual hosts.
#  3. Settings for virtual hosts, which allow Web requests to be sent to
#     different IP addresses or hostnames and have them handled by the
#     same Apache server process.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path.  If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "/var/log/apache2/foo.log"
# with ServerRoot set to "" will be interpreted by the
# server as "//var/log/apache2/foo.log".
#

### Section 1: Global Environment
#
# The directives in this section affect the overall operation of Apache,
# such as the number of concurrent requests it can handle or where it
# can find its configuration files.
#

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# NOTE!  If you intend to place this on an NFS (or otherwise network)
# mounted filesystem then please read the LockFile documentation (available
# at <URL:http://httpd.apache.org/docs-2.1/mod/mpm_common.html#lockfile>);
# you will save yourself a lot of trouble.
#
# Do NOT add a slash at the end of the directory path.
#
ServerRoot "/etc/apache2"

#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
#
#<IfModule !mpm_winnt.c>
#<IfModule !mpm_netware.c>
LockFile /var/lock/apache2/accept.lock
#</IfModule>
#</IfModule>

#
# PidFile: The file in which the server should record its process
# identification number when it starts.
# This needs to be set in /etc/apache2/envvars
#
PidFile ${APACHE_PID_FILE}

#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 15

##
## Server-Pool Size Regulation (MPM specific)
## 

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_worker_module>
    StartServers          2
    MaxClients          150
    MinSpareThreads      25
    MaxSpareThreads      75 
    ThreadsPerChild      25
    MaxRequestsPerChild   0
</IfModule>

# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

#
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives.  See also the AllowOverride
# directive.
#

AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being 
# viewed by Web clients. 
#
<Files ~ "^.ht">
    Order allow,deny
    Deny from all
</Files>

#
# DefaultType is the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value.  If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain


#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.
#
HostnameLookups Off

# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog /var/log/apache2/error.log

#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

# Include module configuration:
Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf

# Include all the user configurations:
Include /etc/apache2/httpd.conf

# Include ports listing
Include /etc/apache2/ports.conf

#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
# If you are behind a reverse proxy, you might want to change %h into %{X-Forwarded-For}i
#
LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined
LogFormat "%h %l %u %t "%r" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

#
# ServerTokens
# This directive configures what you return as the Server HTTP response
# Header. The default is 'Full' which sends information about the OS-Type
# and compiled in modules.
# Set to one of:  Full | OS | Minor | Minimal | Major | Prod
# where Full conveys the most information, and Prod the least.
#
ServerTokens Full

#
# Optionally add a line containing the server version and virtual host
# name to server-generated pages (internal error documents, FTP directory 
# listings, mod_status and mod_info output etc., but not CGI generated 
# documents or custom error documents).
# Set to "EMail" to also include a mailto: link to the ServerAdmin.
# Set to one of:  On | Off | EMail
#
ServerSignature On


#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#

#
# Putting this all together, we can internationalize error responses.
#
# We use Alias to redirect any /error/HTTP_<error>.html.var response to
# our collection of by-error message multi-language collections.  We use 
# includes to substitute the appropriate text.
#
# You can modify the messages' appearance without changing any of the
# default HTTP_<error>.html.var files by adding the line:
#
#   Alias /error/include/ "/your/include/path/"
#
# which allows you to create your own set of files by starting with the
# /usr/share/apache2/error/include/ files and copying them to /your/include/path/, 
# even on a per-VirtualHost basis.  The default include files will display
# your Apache version number and your ServerAdmin email address regardless
# of the setting of ServerSignature.
#
# The internationalized error documents require mod_alias, mod_include
# and mod_negotiation.  To activate them, uncomment the following 30 lines.

#    Alias /error/ "/usr/share/apache2/error/"
#
#    <Directory "/usr/share/apache2/error">
#        AllowOverride None
#        Options IncludesNoExec
#        AddOutputFilter Includes html
#        AddHandler type-map var
#        Order allow,deny
#        Allow from all
#        LanguagePriority en cs de es fr it nl sv pt-br ro
#        ForceLanguagePriority Prefer Fallback
#    </Directory>
#
#    ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
#    ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
#    ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
#    ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
#    ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
#    ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var
#    ErrorDocument 410 /error/HTTP_GONE.html.var
#    ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var
#    ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var
#    ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var
#    ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var
#    ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var
#    ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var
#    ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var
#    ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var
#    ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
#    ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var



# Include of directories ignores editors' and dpkg's backup files,
# see README.Debian for details.

# Include generic snippets of statements
Include /etc/apache2/conf.d/

# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/

My default config file for www on apache

NameVirtualHost *:80
<VirtualHost *:80>
    ServerAdmin info@site.com

    #SSLEnable
    #SSLVerifyClient none
    #SSLCertificateFile /usr/local/ssl/crt/public.crt  
    #SSLCertificateKeyFile /usr/local/ssl/private/private.key  

    DocumentRoot /var/www/site/trunk/html
    <Directory />
        Options FollowSymLinks
        AllowOverride all
    </Directory>
    <Directory /var/www/site/trunk/html>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride all
        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
    ServerSignature On

    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>

My ssl config file

NameVirtualHost *:443
<VirtualHost *:443>
    ServerAdmin info@site.com

    #SSLEnable
    #SSLVerifyClient none
    #SSLCertificateFile /usr/local/ssl/crt/public.crt  
    #SSLCertificateKeyFile /usr/local/ssl/private/private.key  

    DocumentRoot /var/www/site/trunk/html
    <Directory />
        Options FollowSymLinks
        AllowOverride all
    </Directory>
    <Directory /var/www/site/trunk/html>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride all
        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

    SSLEngine On
        SSLCertificateFile /usr/local/ssl/crt/public.crt
        SSLCertificateKeyFile /usr/local/ssl/private/private.key


    CustomLog /var/log/apache2/access.log combined
    ServerSignature On

    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>

My /etc/apache2/httpd.conf is blank

The directory /etc/apache2/conf.d has nothing in it but one file (charset)

contents of /etc/apache2/conf.dcharset

# Read the documentation before enabling AddDefaultCharset.
# In general, it is only a good idea if you know that all your files
# have this encoding. It will override any encoding given in the files
# in meta http-equiv or xml encoding tags.

#AddDefaultCharset UTF-8

My apache error.log

[Wed Jun 03 00:12:31 2009] [error] [client 216.168.43.234] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.DFind:)
[Wed Jun 03 05:03:51 2009] [error] [client 99.247.237.46] File does not exist: /var/www/site/trunk/html/favicon.ico
[Wed Jun 03 05:03:54 2009] [error] [client 99.247.237.46] File does not exist: /var/www/site/trunk/html/favicon.ico
[Wed Jun 03 05:13:48 2009] [error] [client 99.247.237.46] File does not exist: /var/www/site/trunk/html/favicon.ico
[Wed Jun 03 05:13:51 2009] [error] [client 99.247.237.46] File does not exist: /var/www/site/trunk/html/favicon.ico
[Wed Jun 03 05:13:54 2009] [error] [client 99.247.237.46] File does not exist: /var/www/site/trunk/html/favicon.ico
[Wed Jun 03 05:13:57 2009] [error] [client 99.247.237.46] File does not exist: /var/www/site/trunk/html/favicon.ico
[Wed Jun 03 05:17:28 2009] [error] [client 99.247.237.46] File does not exist: /var/www/site/trunk/html/favicon.ico
[Wed Jun 03 05:26:23 2009] [notice] caught SIGWINCH, shutting down gracefully
[Wed Jun 03 05:26:34 2009] [notice] Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.6 with Suhosin-Patch mod_ssl/2.2.8 OpenSSL/0.9.8g configured -- resuming normal operations
[Wed Jun 03 06:03:41 2009] [notice] caught SIGWINCH, shutting down gracefully
[Wed Jun 03 06:03:51 2009] [notice] Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.6 with Suhosin-Patch mod_ssl/2.2.8 OpenSSL/0.9.8g configured -- resuming normal operations
[Wed Jun 03 06:25:07 2009] [notice] caught SIGWINCH, shutting down gracefully
[Wed Jun 03 06:25:17 2009] [notice] Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.6 with Suhosin-Patch mod_ssl/2.2.8 OpenSSL/0.9.8g configured -- resuming normal operations
[Wed Jun 03 12:09:25 2009] [error] [client 61.139.105.163] File does not exist: /var/www/site/trunk/html/fastenv
[Wed Jun 03 15:04:42 2009] [notice] Graceful restart requested, doing restart
[Wed Jun 03 15:04:43 2009] [notice] Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.6 with Suhosin-Patch mod_ssl/2.2.8 OpenSSL/0.9.8g configured -- resuming normal operations
[Wed Jun 03 15:29:51 2009] [error] [client 99.247.237.46] File does not exist: /var/www/site/trunk/html/favicon.ico
[Wed Jun 03 15:29:54 2009] [error] [client 99.247.237.46] File does not exist: /var/www/site/trunk/html/favicon.ico
[Wed Jun 03 15:30:32 2009] [error] [client 99.247.237.46] File does not exist: /var/www/site/trunk/html/favicon.ico
[Wed Jun 03 15:45:54 2009] [notice] caught SIGWINCH, shutting down gracefully
[Wed Jun 03 15:46:05 2009] [notice] Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.6 with Suhosin-Patch mod_ssl/2.2.8 OpenSSL/0.9.8g configured -- resuming normal operations

Понравилась статья? Поделить с друзьями:
  • Error module php5 does not exist
  • Error module not specified intellij idea
  • Error module not specified android studio
  • Error module name must be unique arena
  • Error module is not defined