RHEL/CentOS-ൽ Apache Userdir മൊഡ്യൂൾ എങ്ങനെ പ്രവർത്തനക്ഷമമാക്കാം


http://example.com/~user/ വാക്യഘടന ഉപയോഗിച്ച് ഒരു അപ്പാച്ചെ വെബ് സെർവർ വഴി ഉപയോക്തൃ-നിർദ്ദിഷ്ട ഡയറക്uടറികൾ വീണ്ടെടുക്കാൻ അനുവദിക്കുന്ന ഒരു അപ്പാച്ചെ മൊഡ്യൂളാണ് യൂസർ ഡയറക്uടറി അല്ലെങ്കിൽ യൂസർഡിർ.

ഉദാഹരണത്തിന്, mod_userdir മൊഡ്യൂൾ പ്രവർത്തനക്ഷമമാക്കുമ്പോൾ, സിസ്റ്റത്തിലെ ഉപയോക്താക്കൾക്ക് Apache വെബ് സെർവർ മുഖേന അവരുടെ ഹോം ഡയറക്ടറികളിലെ ഉള്ളടക്കം ആക്സസ് ചെയ്യാൻ കഴിയും.

ഈ ലേഖനത്തിൽ, അപ്പാച്ചെ വെബ് സെർവർ ഉപയോഗിച്ച് RHEL, CentOS, Fedora സെർവറുകളിൽ Apache userdirs (mod_userdir) എങ്ങനെ പ്രവർത്തനക്ഷമമാക്കാമെന്ന് ഞങ്ങൾ കാണിച്ചുതരാം.

നിങ്ങളുടെ ലിനക്സ് വിതരണത്തിൽ ഇതിനകം തന്നെ അപ്പാച്ചെ വെബ് സെർവർ ഇൻസ്റ്റാൾ ചെയ്തിട്ടുണ്ടെന്ന് ഈ ട്യൂട്ടോറിയൽ അനുമാനിക്കുന്നു. നിങ്ങൾക്ക് ഇല്ലെങ്കിൽ, ഇനിപ്പറയുന്ന നടപടിക്രമം ഉപയോഗിച്ച് നിങ്ങൾക്ക് ഇത് ഇൻസ്റ്റാൾ ചെയ്യാൻ കഴിയും…

ഘട്ടം 1: Apache HTTP സെർവർ ഇൻസ്റ്റാൾ ചെയ്യുക

അപ്പാച്ചെ വെബ് സെർവർ ഇൻസ്റ്റാൾ ചെയ്യുന്നതിന്, നിങ്ങളുടെ Linux വിതരണത്തിൽ ഇനിപ്പറയുന്ന കമാൻഡ് ഉപയോഗിക്കുക.

# yum install httpd           [On CentOS/RHEL]
# dnf install httpd           [On Fedora]

ഘട്ടം 2: Apache Userdirs പ്രവർത്തനക്ഷമമാക്കുക

മികച്ച ഓപ്uഷനുകൾ ഉപയോഗിച്ച് ഇതിനകം കോൺഫിഗർ ചെയ്uതിരിക്കുന്ന /etc/httpd/conf.d/userdir.conf എന്ന കോൺഫിഗറേഷൻ ഫയലിൽ ഈ മൊഡ്യൂൾ ഉപയോഗിക്കുന്നതിന് ഇപ്പോൾ നിങ്ങളുടെ അപ്പാച്ചെ വെബ് സെർവർ കോൺഫിഗർ ചെയ്യേണ്ടതുണ്ട്.

# vi /etc/httpd/conf.d/userdir.conf

തുടർന്ന് ചുവടെയുള്ളതുപോലെ ഉള്ളടക്കം സാധൂകരിക്കുക.

# directory if a ~user request is received.
#
# The path to the end user account 'public_html' directory must be
# accessible to the webserver userid.  This usually means that ~userid
# must have permissions of 711, ~userid/public_html must have permissions
# of 755, and documents contained therein must be world-readable.
# Otherwise, the client will only receive a "403 Forbidden" message.
#
<IfModule mod_userdir.c>
    #
    # UserDir is disabled by default since it can confirm the presence
    # of a username on the system (depending on home directory
    # permissions).
    #
    UserDir enabled tecmint

    #
    # To enable requests to /~user/ to serve the user's public_html
    # directory, remove the "UserDir disabled" line above, and uncomment
    # the following line instead:
    #
    UserDir public_html
</IfModule>

#
# Control access to UserDir directories.  The following is an example
# for a site where these directories are restricted to read-only.
#
<Directory "/home/*/public_html">
    ## Apache 2.4 users use following ##
    AllowOverride FileInfo AuthConfig Limit Indexes
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    Require method GET POST OPTIONS

## Apache 2.2 users use following ##
        Options Indexes Includes FollowSymLinks        
        AllowOverride All
        Allow from all
        Order deny,allow
</Directory>

കുറച്ച് ഉപയോക്താക്കളെ UserDir ഡയറക്uടറികൾ ആക്uസസ് ചെയ്യാൻ അനുവദിക്കുന്നതിന്, എന്നാൽ മറ്റാരെയും ആക്uസസ് ചെയ്യാതിരിക്കാൻ, കോൺഫിഗറേഷൻ ഫയലിൽ ഇനിപ്പറയുന്ന ക്രമീകരണം ഉപയോഗിക്കുക.

UserDir disabled
UserDir enabled testuser1 testuser2 testuser3

എല്ലാ ഉപയോക്താക്കളെയും UserDir ഡയറക്uടറികൾ ആക്uസസ് ചെയ്യാൻ അനുവദിക്കുകയും എന്നാൽ കുറച്ച് ഉപയോക്താക്കൾക്ക് ഇത് പ്രവർത്തനരഹിതമാക്കുകയും ചെയ്യുന്നതിന്, കോൺഫിഗറേഷൻ ഫയലിൽ ഇനിപ്പറയുന്ന ക്രമീകരണം ഉപയോഗിക്കുക.

UserDir enabled
UserDir disabled testuser4 testuser5 testuser6

നിങ്ങളുടെ ആവശ്യകതകൾക്കനുസരിച്ച് കോൺഫിഗറേഷൻ ക്രമീകരണങ്ങൾ ചെയ്തുകഴിഞ്ഞാൽ, സമീപകാല മാറ്റങ്ങൾ പ്രയോഗിക്കുന്നതിന് നിങ്ങൾ അപ്പാച്ചെ വെബ് സെർവർ പുനരാരംഭിക്കേണ്ടതുണ്ട്.

# systemctl restart httpd.service  [On SystemD]
# service httpd restart            [On SysVInit]

ഘട്ടം 3: ഉപയോക്തൃ ഡയറക്ടറികൾ സൃഷ്ടിക്കുന്നു

ഇപ്പോൾ നിങ്ങൾ ഉപയോക്താവിന്റെ/ഉപയോക്താക്കളുടെ ഹോം ഡയറക്uടറികളിൽ ഒരു public_html ഡയറക്uടറി/ഡയറക്uടറികൾ സൃഷ്uടിക്കേണ്ടതുണ്ട്. ഉദാഹരണത്തിന്, ഇവിടെ ഞാൻ tecmint-ന്റെ ഉപയോക്തൃ ഹോം ഡയറക്uടറിക്ക് കീഴിൽ ഒരു public_html ഡയറക്uടറി സൃഷ്uടിക്കുന്നു.

# mkdir /home/tecmint/public_html

അടുത്തതായി, യൂസർ ഹോമിലും public_html ഡയറക്ടറികളിലും ശരിയായ അനുമതികൾ പ്രയോഗിക്കുക.

# chmod 711 /home/tecmint
# chown tecmint:tecmint /home/tecmint/public_html
# chmod 755 /home/tecmint/public_html

കൂടാതെ, അപ്പാച്ചെ ഹോംഡിറുകൾക്ക് (httpd_enable_homedirs) ശരിയായ SELinux സന്ദർഭം സജ്ജമാക്കുക.

# setsebool -P httpd_enable_homedirs true
# chcon -R -t httpd_sys_content_t /home/tecmint/public_html

ഘട്ടം 4: പ്രവർത്തനക്ഷമമാക്കിയ Apache Userdir പരീക്ഷിക്കുക

അവസാനമായി, നിങ്ങളുടെ ബ്രൗസർ സെർവർ ഹോസ്റ്റ്നാമത്തിലേക്കോ IP വിലാസത്തിലേക്കോ ഉപയോക്തൃനാമത്തിലേക്കോ ചൂണ്ടിക്കാണിച്ചുകൊണ്ട് Userdir സ്ഥിരീകരിക്കുക.

http://example.com/~tecmint
OR
http://192.168.0.105/~tecmint

നിങ്ങൾക്ക് വേണമെങ്കിൽ, ഇനിപ്പറയുന്ന ഫയലുകൾ സൃഷ്ടിച്ചുകൊണ്ട് നിങ്ങൾക്ക് HTML പേജുകളും PHP വിവരങ്ങളും പരിശോധിക്കാനും കഴിയും.

ഇനിപ്പറയുന്ന ഉള്ളടക്കം ഉപയോഗിച്ച് /home/tecmint/public_html/test.html ഫയൽ സൃഷ്ടിക്കുക.

<html>
  <head>
    <title>TecMint is Best Site for Linux</title>
  </head>
  <body>
    <h1>TecMint is Best Site for Linux</h1>
  </body>
</html>

ഇനിപ്പറയുന്ന ഉള്ളടക്കം ഉപയോഗിച്ച് /home/tecmint/public_html/test.php ഫയൽ സൃഷ്ടിക്കുക.

<?php
  phpinfo();
?>

അത്രയേയുള്ളൂ! ഈ ലേഖനത്തിൽ, ഉപയോക്താക്കൾക്ക് അവരുടെ ഹോം ഡയറക്uടറികളിൽ നിന്ന് ഉള്ളടക്കം പങ്കിടാൻ അനുവദിക്കുന്നതിന് Userdir മൊഡ്യൂൾ എങ്ങനെ പ്രവർത്തനക്ഷമമാക്കാമെന്ന് ഞങ്ങൾ വിശദീകരിച്ചിട്ടുണ്ട്. ഈ ലേഖനത്തെക്കുറിച്ച് നിങ്ങൾക്ക് സംശയങ്ങളുണ്ടെങ്കിൽ, ചുവടെയുള്ള അഭിപ്രായ വിഭാഗത്തിൽ ചോദിക്കാൻ മടിക്കേണ്ടതില്ല.