Skip to main content

How to Creation and Installation Your Website (Apache2) in Raspberry Pi?

How To Creation And Installation Your Website (Apache2) In Raspberry Pi?

How To Creation And Installation Your Website (Apache2) In Raspberry Pi?

Introduction

If you had wanted to make your website in Raspbian, you should use to apache2. Because apache2 is a very powerful website. Let me show how to install apache2 for you.

Equipment

Operation System: Raspbian (NOOBS v1.3.10)
Web Site version: apache2_2.4.10-8

Usage

1.. To Install an apache2.
pi@raspberrypi ~ $ sudo su
root@raspberrypi:/home/pi# apt-get install apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
 libatk-wrapper-java libatk-wrapper-java-jni libauthen-sasl-perl
 libbit-vector-perl libcarp-clan-perl libclass-accessor-perl
 libclass-data-inheritable-perl libclass-method-modifiers-perl
 libcommon-sense-perl libcrypt-openssl-bignum-perl libcrypt-openssl-rsa-perl
 libdata-random-perl libdate-calc-perl libdate-calc-xs-perl
 libdigest-hmac-perl libencode-locale-perl libextutils-depends-perl
 libextutils-pkgconfig-perl libfile-basedir-perl libfile-listing-perl
 libfile-which-perl libfont-afm-perl libgconf2-4 libgd-perl
 libgnome2-canvas-perl libgnome2-gconf-perl libgnome2-perl libgnome2-vfs-perl
 libgnome2-wnck-perl libgoo-canvas-perl libgoocanvas-common libgoocanvas3
 libgtk2-imageview-perl libgtk2-unique-perl libgtkimageview0
 libhtml-form-perl libhtml-format-perl libhtml-parser-perl
 libhtml-tagset-perl libhtml-tree-perl libhttp-cookies-perl
 libhttp-daemon-perl libhttp-date-perl libhttp-message-perl
 libhttp-negotiate-perl libhttp-server-simple-perl libio-html-perl
 libio-socket-ssl-perl libjpeg-progs libjpeg9 libjson-perl libjson-xs-perl
 liblwp-mediatypes-perl libmailtools-perl libmouse-perl libnet-http-perl
 libnet-smtp-ssl-perl libnet-ssleay-perl libpath-class-perl
 libproc-processtable-perl libproc-simple-perl libsort-naturally-perl
 libsub-name-perl libtie-ixhash-perl libunique-1.0-0 liburi-perl
 libwww-robotrules-perl libxml-libxml-perl libxml-namespacesupport-perl
 libxml-sax-base-perl libxml-sax-perl libxml-simple-perl
 libxml-xpathengine-perl perlmagick tzdata-java
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
 openssl ssl-cert
Suggested packages:
 apache2-doc apache2-suexec-pristine apache2-suexec-custom ca-certificates
 openssl-blacklist
The following NEW packages will be installed:
 apache2 openssl ssl-cert
0 upgraded, 3 newly installed, 0 to remove and 109 not upgraded.
Need to get 0 B/887 kB of archives.
After this operation, 1,463 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
WARNING: The following packages cannot be authenticated!
 apache2 openssl ssl-cert
Install these packages without verification? [y/N] Y
Preconfiguring packages ...
Selecting previously unselected package apache2.
(Reading database ... 96191 files and directories currently installed.)
Preparing to unpack .../apache2_2.4.10-8_armhf.deb ...
Unpacking apache2 (2.4.10-8) ...
Selecting previously unselected package openssl.
Preparing to unpack .../openssl_1.0.1j-1_armhf.deb ...
Unpacking openssl (1.0.1j-1) ...
Selecting previously unselected package ssl-cert.
Preparing to unpack .../ssl-cert_1.0.35_all.deb ...
Unpacking ssl-cert (1.0.35) ...
Processing triggers for man-db (2.7.0.2-4) ...
Setting up apache2 (2.4.10-8) ...
Enabling module mpm_event.
Enabling module authz_core.
Enabling module authz_host.
Enabling module authn_core.
Enabling module auth_basic.
Enabling module access_compat.
Enabling module authn_file.
Enabling module authz_user.
Enabling module alias.
Enabling module dir.
Enabling module autoindex.
Enabling module env.
Enabling module mime.
Enabling module negotiation.
Enabling module setenvif.
Enabling module filter.
Enabling module deflate.
Enabling module status.
Enabling conf charset.
Enabling conf localized-error-pages.
Enabling conf other-vhosts-access-log.
Enabling conf security.
Enabling conf serve-cgi-bin.
Enabling site 000-default.
[....] Starting web server: apache2AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
. ok
Setting up openssl (1.0.1j-1) ...
Setting up ssl-cert (1.0.35) ...

2.. To make sure the apache2 correctly.

2.1. Open a browser (I prefer using Chromium.). Such as Dillo, NetSurf and Chromium.

2.2. Type a hyperlink as http://127.0.1.1 .

2.3. If you can see an apach2 default homepage, congratulation! Your website has been open 80 port in your Raspbian. That means you can start to develop your web site.

2.4. The default homepage is there (/var/www/html/index.html). To change it made your website by you.

3.. I consider you need to configure apache2 in future. You have to restart apache2 and load new configuration into apache2.

3.1. To restart apache2.
If you are using Ubuntu use sudo. By the way, You can use 'sudo su' to change into the root.
$ sudo /etc/init.d/apache2 restart
Or
# /etc/init.d/apache2 restart
Or
# apache2ctl restart
[....] Restarting web server: apache2AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
. ok

3.2. To stop apache2.
$ sudo /etc/init.d/apache2 stop
Or
# /etc/init.d/apache2 stop
Or
# apache2ctl stop
[ ok ] Stopping web server: apache2.

3.3. To start apache2.
$ sudo /etc/init.d/apache2 start
Or
# /etc/init.d/apache2 start
Or
# apache2ctl start
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message

Exception

If you want to change the port of web site, you could modify the file (/etc/apache2/ports.conf).
1.. To edit ports.conf.
$ cd /etc/apache2
$ sudo nano ports.conf
You can see the word 'Listen' with a number (80). The number is the port of your website and then change it you want. Save it. But you have to restart apache2 and then it will be loaded automatically.

Acknowledge

Thank you (Apache2) very much for this great tool.

Popular posts from this blog

Python 日期與時間的處理

Visual Basic 6.0 (VB6) 程式語言案例學習 (10. 條碼列印程式)

寫作:波蘭文學習之旅:1-1. 波蘭文字母與發音(注音版)

Python 日期與時間的處理

Image

Visual Basic 6.0 (VB6) 程式語言案例學習 (10. 條碼列印程式)

Image

寫作:波蘭文學習之旅:1-1. 波蘭文字母與發音(注音版)

Image

數位影像處理:最佳化處理策略之快速消除扭曲演算法

Image

用10種程式語言做影像二值化(Image binarization)

Image

Visual Basic 6.0 (VB6) 程式語言案例學習 (04. 人事考勤管理系統)

Image

Visual Basic .Net (VB.Net) 程式語言案例學習 (06. 題庫測驗系統)

Image

Visual Basic 6.0 (VB6) 程式語言案例學習 (11. 生產線拍照程式)

Image

Visual Basic 6.0 (VB6) 程式語言案例學習 (07. 收據列印程式)

Image

Visual Basic .Net (VB.Net) 程式語言案例學習 (03. 場地預約系統)

Image