Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

165
Views
¿Cómo puedo hacer que un área de un sitio web esté protegida con contraseña a través de Apache?

He estado trabajando en esto por un tiempo y estoy tratando de usar .htaccess y .htpasswd . Esto es lo que he hecho:

Realizado con Apache usando Raspberry Pi 3B+ con DietPi instalado.

  • Creé un nuevo archivo .htpasswd y procedí a ingresar la contraseña que quería.

  • A continuación, me redirigió a /etc/apache2/sites-enabled/ donde edité 000-default.conf y cambié la línea de código:

     <VirtualHost *80> ServerName www.example.com ServerAdmin webmaster@localhost DocumentRoot /var/www/ ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined <Directory "/var/www/etc/" AuthType Basic AuthName "Restricted Content" AuthUserFile /etc/apache2/.htpasswd Require valid-user </Directory> RewriteEngine on RewriteCond %{SERVER_NAME} =example.com RewriteRule ^https://%{SERVER_NAME%{REQUEST_URI} [END,Ne,R=permanent] </VirtualHost>

Todo aquí es igual, excepto reemplazar "ejemplo" con mi dominio.

Esto no afectó a mi sitio, así que lo redirigí a /etc/apache2/ donde apache2.conf y agregué la línea de código:

 <Directory /var/www/etc/> DirectoryIndex index.php index.html Options Indexes FollowSymLinks AllowOverride None Require all denied </Directory>

Una vez más, todo aquí es igual. etc es el archivo que quiero proteger con contraseña. Esto hizo que la página que quería proteger fuera completamente inaccesible, y cuando cambié AllowOverride y Require all , simplemente hizo que la página se abriera por completo. ¿Cómo puedo hacer que se solicite una contraseña cuando intente acceder al directorio?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!