Конфигурирование virtualhost и .htaccess на localhost с использованием apache с linux ubuntu - PullRequest
0 голосов
/ 06 марта 2020

Я пытаюсь настроить веб-сайт "redspot.es" на локальном хосте с apache сервером в дистрибутиве Ubuntu linux. Я хочу, чтобы этот сайт можно было получить с локального хоста без написания слова "localhost" перед его именем (redspot.es) в URL-адресе браузера.

Когда я пытаюсь получить доступ к redspot.es (на локальном хосте) в браузер я получаю это:

Not Found
The requested URL / was not found on this server.

Apache/2.4.29 (Ubuntu) Server at redspot.es Port 80

Я пытаюсь найти причину этого: я подозреваю, что проблема может быть в .htaccess и файлах конфигурации .conf:

Я разместил этот сайт в / var / www/redspot.es/public_html .htaccess, файл помещен в / var / www/redspot.es и в / var / www/redspot.es/public_html:

DirectoryIndex index.php index.html index.htm
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>

AuthName redspot.es

#remove www de la url, si es que NO (!) es la url ya (^)(empieza por)rinconintangible.es ( y después, como no lleva $(fin), puede llevar cuales quiera cosas)
RewriteEngine On
#RewriteCond %{HTTP_HOST} !^redspot\.es
#RewriteRule (.*) http://redspot.es/$1 [R=301]
# las 2 vlíneas anteriores las ocmento porque ya las hago en el htaccess de un nivel de carpetas superior, es decir, desde la carpeta /public_html/ del server

#remove index.php de la url http://redspot.es/index.php No lo quita de las que no acaban en index.php, ej: index.php?jsdjsdjs=ygg&hsbs=hhh
RewriteCond %{THE_REQUEST} ^GET\ .*/index\.(php|html)\ HTTP
RewriteRule ^(.*)index\.(php|html)$ /$1 [R=301]

И / etc / apache2 / sites -available / redspot.es.conf:

<VirtualHost *:80>
    ServerName redspot.es
    ServerAlias www.redspot.es
    ServerAdmin admin@redspot.es
    DocumentRoot /var/www/html/redspot.es/public_html

    <Directory /var/www/html/redspot.es/public_html>
        Options FollowSymLinks MultiViews
        AllowOverride All  
        Order allow,deny 
        Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Также я включаю сайт:

/etc/apache2/sites-enabled$ sudo a2ensite redspot.es

И в / etc / hosts у меня есть это:

127.0.0.1   localhost
127.0.1.1   than-pc
192.168.1.137   redspot.es

1 Ответ

0 голосов
/ 07 марта 2020

Solutioned. Похоже, что для помещения папки сайта в папку /var/www/html (/ var / www/html/redspot.es/public_html/) необходимо

...