Si të instaloni Forumin phpBB me Apache dhe falas Lets Encrypt SSL në Ubuntu 22.04


phpBB është softuer forumi falas dhe me burim të hapur që ofron një hapësirë për njerëzit që të mblidhen dhe të komunikojnë me njëri-tjetrin. Është shkruar në PHP dhe përdor MariaDB si një bazë të dhënash. Ai ofron një grup të pasur karakteristikash, duke përfshirë nën-forume, grupe përdoruesish, kërkim me tekst të plotë, shtojca dhe njoftime me email. Është plotësisht i shkallëzueshëm dhe i personalizueshëm, dhe ka një ndërfaqe miqësore për përdoruesit dhe opsione të drejtpërdrejta menaxhimi.

Ky postim do t'ju tregojë se si të instaloni phpBB me Apache dhe Lets Encrypt SSL në Ubuntu 22.04.

Parakushtet

  • Një server që ekzekuton Ubuntu 22.04.
  • Një emër i vlefshëm domeni i treguar me IP-në e serverit tuaj.
  • Një fjalëkalim rrënjësor është konfiguruar në server.

Instaloni Apache, MariaDB dhe PHP

Së pari, do t'ju duhet të instaloni serverin në internet Apache, serverin e bazës së të dhënave MariaDB, PHP dhe paketa të tjera në serverin tuaj. Ju mund t'i instaloni të gjitha ato duke ekzekutuar komandën e mëposhtme:

apt install apache2 mariadb-server php libapache2-mod-php php-gd php-curl openssl php-imagick php-intl php-json php-ldap php-common php-mbstring php-mysql php-imap php-sqlite3 php-net-ftp php-zip unzip php-pgsql php-ssh2 php-xml wget unzip -y

Pasi të jenë instaluar të gjitha paketat, filloni dhe aktivizoni shërbimin Apache me komandën e mëposhtme:

systemctl start apache2
systemctl enable apache2

Krijoni një bazë të dhënash për phpBB

phpBB përdor një MariaDB për të ruajtur të dhënat e tyre. Pra, do t'ju duhet të krijoni një bazë të dhënash dhe përdorues për phpBB. Së pari, hyni në guaskën MariaDB me komandën e mëposhtme:

mysql

Pasi të jeni regjistruar, krijoni një bazë të dhënash dhe përdorues me komandën e mëposhtme:

MariaDB [(none)]> CREATE DATABASE phpdb;
MariaDB [(none)]> GRANT ALL ON phpdb.* to 'phpuser'@'localhost' IDENTIFIED BY 'password';

Më pas, lani privilegjet dhe dilni nga MariaDB me komandën e mëposhtme:

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Pasi të keni mbaruar, mund të vazhdoni në hapin tjetër.

Shkarkoni phpBB

Më pas, do t'ju duhet të shkarkoni versionin më të fundit të phpBB nga faqja e tyre zyrtare e shkarkimit. Mund ta shkarkoni me komandën e mëposhtme:

wget https://download.phpbb.com/pub/release/3.3/3.3.7/phpBB-3.3.7.zip

Pasi të shkarkohet phpBB, hiqni skedarin e shkarkuar me komandën e mëposhtme:

unzip phpBB-3.3.7.zip

Më pas, zhvendosni direktorinë e nxjerrë në direktorinë rrënjësore të uebit Apache:

mv phpBB3 /var/www/html/phpbb

Më pas, ndryshoni pronësinë dhe lejen e drejtorisë phpbb:

chown -R www-data:www-data /var/www/html/phpbb
chmod -R 775 /var/www/html/phpbb

Pasi të keni mbaruar, mund të vazhdoni në hapin tjetër.

Konfiguro Apache për phpBB

Më pas, duhet të krijoni një skedar konfigurimi të hostit virtual Apache për të pritur phpBB. Mund ta krijoni me komandën e mëposhtme:

nano /etc/apache2/sites-available/phpbb.conf

Shtoni rreshtat e mëposhtëm:

<VirtualHost *:80>
      ServerAdmin 
      DocumentRoot /var/www/html/phpbb
      ServerName phpbb.example.com

      <Directory /var/www/html/phpbb>
                Options FollowSymlinks
                AllowOverride All
                Require all granted
       </Directory>

ErrorLog ${APACHE_LOG_DIR}/phpbb_error.log
CustomLog ${APACHE_LOG_DIR}/phpbb_access.log combined


</VirtualHost>

Ruani dhe mbyllni skedarin kur të keni mbaruar, më pas aktivizoni hostin virtual Apache dhe rishkruani modulin me komandën e mëposhtme:

a2ensite phpbb
a2enmod rewrite

Më pas, rinisni shërbimin Apache për të aplikuar ndryshimet:

systemctl restart apache2

Ju gjithashtu mund të kontrolloni statusin e shërbimit Apache duke përdorur komandën e mëposhtme:

systemctl status apache2

Do të merrni daljen e mëposhtme:

? apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2022-05-28 10:50:04 UTC; 2s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 22212 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 22217 (apache2)
      Tasks: 6 (limit: 2292)
     Memory: 15.8M
        CPU: 98ms
     CGroup: /system.slice/apache2.service
             ??22217 /usr/sbin/apache2 -k start
             ??22218 /usr/sbin/apache2 -k start
             ??22219 /usr/sbin/apache2 -k start
             ??22220 /usr/sbin/apache2 -k start
             ??22221 /usr/sbin/apache2 -k start
             ??22222 /usr/sbin/apache2 -k start

May 28 10:50:04 ubuntu2204 systemd[1]: Starting The Apache HTTP Server...

Hyni në ndërfaqen e internetit phpBB

Tani, hapni shfletuesin tuaj të internetit dhe hyni në ndërfaqen e internetit phpBB duke përdorur URL-në http://phpbb.example.com. Ju duhet të shihni faqen e mëposhtme:

Klikoni në skedën INSTALL dhe kliko në butonin Instalo për të nisur instalimin. Ju duhet të shihni faqen e mëposhtme:

Jepni emrin e përdoruesit, fjalëkalimin e administratorit dhe klikoni në butonin Dërgo. Ju duhet të shihni faqen e mëposhtme:

Jep hostin e bazës së të dhënave, portin, emrin e bazës së të dhënave, emrin e përdoruesit, fjalëkalimin dhe klikoni në butonin Dërgo. Ju duhet të shihni faqen e mëposhtme:

Jepni protokollin tuaj, emrin e domenit të uebsajtit, portin, rrugën dhe klikoni në butonin Dërgo. Ju duhet të shihni faqen e mëposhtme:

Jepni detajet tuaja SMTP dhe klikoni në butonin Dërgo. Ju duhet të shihni faqen e mëposhtme:

Zgjidhni gjuhën tuaj, emrin e tabelës, përshkrimin e tabelës dhe klikoni në butonin Dërgo. Ju duhet të shihni faqen e mëposhtme:

Klikoni në butonin Më çoni te ACP. Ju duhet të shihni panelin e kontrollit phpBB në faqen e mëposhtme:

Siguroni phpBB me Lets Encrypt SSL

Është gjithmonë një ide e mirë për të siguruar faqen tuaj të internetit me Lets Encrypt SSL. Ju do të duhet të instaloni klientin Certbot për të instaluar dhe menaxhuar SSL. Mund ta instaloni me komandën e mëposhtme:

apt-get install python3-certbot-apache -y

Pasi të instalohet Certbot, ekzekutoni komandën e mëposhtme për të siguruar faqen tuaj të internetit me Lets Encrypt SSL:

certbot --apache -d phpbb.example.com

Do t'ju kërkohet të jepni emailin tuaj dhe të pranoni afatin e shërbimit siç tregohet më poshtë:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator standalone, Installer None
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
Plugins selected: Authenticator apache, Installer apache
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for phpbb.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/phpbb-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/phpbb-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/phpbb-le-ssl.conf

Më pas, zgjidhni nëse do të ridrejtoni apo jo trafikun HTTP në HTTPS siç tregohet më poshtë:

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

Shkruani 2 dhe shtypni Enter për të instaluar Lets Encrypt SSL për faqen tuaj të internetit:

Enabled Apache rewrite module
Redirecting vhost in /etc/apache2/sites-enabled/phpbb.conf to ssl vhost in /etc/apache2/sites-available/phpbb-le-ssl.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://phpbb.example.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=phpbb.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/phpbb.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/phpbb.example.com/privkey.pem
   Your cert will expire on 2022-08-12. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

Tani, mund të hyni në uebsajtin tuaj të sigurt duke përdorur URL-në https://phpbb.example.com.

konkluzioni

urime! ju keni instaluar me sukses phpBB me Apache dhe Lets Encrypt SSL në Ubuntu 22.04. Tani mund të eksploroni panelin e kontrollit phpBB dhe të filloni të krijoni tabelën tuaj të parë.