s50
httpd installation.
Install httpd.
[root@www ~]# 50_1dnf -y install httpd
s51Remove the welcome page.
[root@www ~]# 51_1rm -f /etc/httpd/conf.d/welcome.conf
s52Configure httpd.
[root@www ~]# 52_1vi /etc/httpd/conf/httpd.conf
s53Line 100: Remove the “#” at the beginning of the line to uncomment it and specify the server name.
ServerName 53_1fedoraserver.jp:80
s54Line 156: Change.
AllowOverride 54_1All
s55Line 169: Add a file name that can be accessed only with the directory name.
DirectoryIndex index.html 55_1index.cgi index.php index.rb index.py
s56Line 321: Comment out to deal with garbled characters.
56_1#AddDefaultCharset UTF-8
s57Edit document root owner (webmaster).
[root@www ~]# 57_1chown webmaster. /var/www/html/
s58Check document root owner.
[root@www ~]# 58_1ll /var/www/ 合計 0 drwxr-xr-x 2 root root 6 4月 24 22:46 cgi-bin drwxr-xr-x 2 webmaster webmaster 6 4月 24 22:46 html
s59Set the www of the URL.
[root@www ~]# 59_1vi /etc/httpd/conf.d/virtualhost-00-fedoraserver.jp.conf
s60Unify without www.
60_1<VirtualHost *:80>
ServerName fedoraserver.jp
DocumentRoot /var/www/html
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.fedoraserver.jp
RewriteRule ^(.*)$ http://fedoraserver.jp/$1 [R=301,L]
</VirtualHost>
s61start up.
[root@www ~]# 61_1systemctl start httpd
s62Set auto start.
[root@www ~]# 62_1systemctl enable httpd
s63Create an HTML test page.
[root@www ~]# 63_1vi /var/www/html/index.html 63_2<html> <body> <div style="width: 100%; font-size: 20px; font-weight: bold; text-align: center;"> Test Page </div> </body> </html>
s64Start the web browser, access the page, and check the operation.
http://fedoraserver.jp
s65
Open TCP port 80.
Open TCP port 80 in your router settings. (Check the setting method according to your own environment.)s66
Port open test
“Host name(fedoraserver.jp)” and “Port number (80)” are open.
s67
Install Perl.
Install Perl.
[root@www ~]# 67_1dnf -y install perl perl-CGI
s68Set to allow CGI execution in the “html” directory.
[root@www ~]# 68_1vi /etc/httpd/conf.d/html.conf
s69Set extensions cgi, pl, rb, py as CGI.
69_1<Directory "/var/www/html">
Options +ExecCGI
AddHandler cgi-script .cgi .pl .rb .py
</Directory>
s70Allow access to Perl commands in “/usr/local/bin/perl”.
[root@www ~]# 70_1ln -s /usr/bin/perl /usr/local/bin/perl
s71Check your Perl path.
[root@www ~]# 71_1whereis perl perl: /usr/bin/perl /usr/local/bin/perl /usr/share/man/man1/perl.1.gz
s72Restart.
[root@www ~]# 72_1systemctl restart httpd
s73Create a CGI test page.
[root@www ~]# 73_1vi /var/www/html/index.cgi 72_2#!/usr/bin/perl print "Content-type: text/htmlnn"; print "<html>n<body>n"; print "<div style="width: 100%; font-size: 20px; font-weight: bold; text-align: center;">n"; print "CGI Test Page"; print "n</div>n"; print "</body>n</html>n";
s74Set permissions.
[root@www ~]# 74_1chmod 705 /var/www/html/index.cgi
s75Start the web browser, access the page, and check the operation.
http://fedoraserver.jp/index.cgi
s76
PHP installation.
Install PHP.
[root@www ~]# 76_1dnf -y install php php-mbstring php-pear
s77Configure PHP.
[root@www ~]# 77_1vi /etc/php.ini
s78Line 927: Remove the “;” at the beginning of the line, uncomment it, and add your own time zone.
PHP timezone list
date.timezone = 78_1"Asia/Tokyo"
s79Restart.
[root@www ~]# 79_1systemctl restart httpd
s80Create a PHP test page.
[root@www ~]# 80_1vi /var/www/html/index.php 79_2<html> <body> <div style="width: 100%; font-size: 20px; font-weight: bold; text-align: center;"> <?php print "PHP Test Page"; ?> </div> </body> </html>
s81Start the web browser, access the page, and check the operation.
http://fedoraserver.jp/index.php
s82
Install Ruby.
Install Ruby.
[root@www ~]# 82_1dnf -y install ruby
s83Restart.
[root@www ~]# 83_1systemctl restart httpd
s84Create a Ruby test page.
[root@www ~]# 84_1vi /var/www/html/index.rb 83_2#!/usr/bin/ruby print "Content-type: text/htmlnn"; print "<html>n<body>n"; print "<div style="width: 100%; font-size: 20px; font-weight: bold; text-align: center;">n"; print "Ruby Test Page"; print "n</div>n"; print "</body>n</html>n";
s85Set permissions.
[root@www ~]# 85_1chmod 705 /var/www/html/index.rb
s86Start the web browser, access the page, and check the operation.
http://fedoraserver.jp/index.rb
Install Perl modules.
Launch CPAN.
root@www:~# 91_1perl -MCPAN -e shell
s92Enter “y” and press Enter.
Would you like to configure as much as possible automatically? [yes] 92_1y
s93Check it and click “OK” to display the installation log.
s94Install the module.
[root@www ~]# 94_1
s95
Install ImageMagik.
Install ImageMagick.
[root@www ~]# 95_1dnf -y install ImageMagick
s96Install perl ImageMagick.
[root@www ~]# 96_1dnf -y install ImageMagick-perl
s97
Obtaining a server certificate.
Install Certbot.
[root@www ~]# 97_1dnf -y install certbot
s98Get a certificate.
Document root: /var/www/html/
email address: webmaster@fedoraserver.jp
Web server name: fedoraserver.jp
[root@www ~]# 98_1certbot certonly --webroot -w /var/www/html/ -m webmaster@fedoraserver.jp -d fedoraserver.jp --agree-tos
s99Configure automatic certificate renewal.
[root@www ~]# 99_1vi /etc/cron.d/letsencrypt
s100Add the following.
100_100 16 * * 2 root /usr/bin/certbot renew --post-hook "service httpd restart"
s101
SSL settings.
Install SSL to enable encrypted communication.
[root@www ~]# 101_1dnf install mod_ssl
s102Configure SSL.
[root@www ~]# 102_1vi /etc/httpd/conf.d/ssl.conf
s103Line 59: Remove the “#” at the beginning of the line to uncomment it.
DocumentRoot "/var/www/html"
s104Line 75: Remove the “#” at the beginning of the line to uncomment it and change it.
SSLProtocol 104_1-All +TLSv1 +TLSv1.1 +TLSv1.2
s105Line 101: Specify the obtained certificate.
SSLCertificateFile 105_1/etc/letsencrypt/live/fedoraserver.jp/cert.pem
s106Line 109: Specify the obtained key file.
SSLCertificateKeyFile 106_1/etc/letsencrypt/live/fedoraserver.jp/privkey.pem
s107Line 118: Remove the “#” at the beginning of the line to uncomment it and specify the obtained intermediate certificate.
SSLCertificateChainFile 107_1/etc/letsencrypt/live/fedoraserver.jp/chain.pem
s108Restart.
[root@www ~]# 108_1systemctl restart httpd
s109“「https://fedoraserver.jp” operation check.
コメント