You need to enable javaScript to run this app.

Nginx : Enable Userdir

  • Senin, 28 Juli 2025
  • Kanghaki
  • 0 komentar
Nginx : Enable Userdir
 
Enable Userdir for common users to open their site in the home directories.
[1] Configure Nginx. Add settings into [server] section of a site definition you'd like to set.
root@www:~# 
vi /etc/nginx/sites-available/default
# add into [server] section

server {
        .....
        .....
        location ~ ^/~(.+?)(/.*)?$ {
              alias /home/$1/public_html$2;
              index  index.html index.htm;
              autoindex on;
        }

root@www:~# 
systemctl restart nginx
[2] Create a test page with a common user to make sure it works normally.
debian@www:~$ 
chmod 711 /home/debian

debian@www:~$ 
mkdir ~/public_html

debian@www:~$ 
chmod 755 ~/public_html

debian@www:~$ 
vi ~/public_html/index.html
<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
Nginx UserDir Test Page
</div>
</body>
</html>
Bagikan artikel ini:

Beri Komentar

Kang Haki

- Ketua -

Jika kamu tak tahan letihnya dan penatnya belajar, maka sungguh kamu akan menanggung perihnya kebodohan (nasehat imam syafi'i). Kulon Progo, 22…

Berlangganan
Jajak Pendapat

Skill apa yang kalian pengin kuasai selama PKL?

Hasil
Banner