vuuuk
Anonymous
768 x views • 5 years ago
#! /bin/bash
echo "--> CentOS System, Pasang Apache, PHP, MariaDB <--"
echo "Nama Pelanggan : ";
read a;
echo "Selamat Datang Mr./Mrs. $a, Lanjut?";
sudo yum -y update
sudo reboot
#https://www.youtube.com/watch?v=YGNeZV1raGQ&feature=emb_title
#_On Fedora, standards repositories are enough, on Enterprise Linux (RHEL, CentOS) the Extra Packages for Enterprise #_Linux (EPEL) repository must be configured, and on RHEL the optional channel must be enabled.
yum update && yum install epel-release
#_CentOS version 7.7
yum update && yum install epel-release
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget https://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-12.noarch.rpm
rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm #[On CentOS/RHEL 7]
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm
#_centos6
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
#_CentOS version 8.0
dnf install http://rpms.remirepo.net/fedora/remi-release-29.rpm #[On Fedora 29]
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
#_Fedora 31
dnf install https://rpms.remirepo.net/fedora/remi-release-31.rpm
#_Fedora 30
dnf install https://rpms.remirepo.net/fedora/remi-release-30.rpm
#_RHEL version 8.1
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
#_RHEL version 7.7
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget https://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm
subscription-manager repos --enable=rhel-7-server-optional-rpms
#_RHEL or CentOS 7
yum install yum-utils
#shows all enabled repositories. These two commands are identical.
yum repolist
yum -v repolist all
yum repolist disabled
#_For example, to install PHP 7.x version, use the following command.
#_---------CentOS & RHEL -------------
yum-config-manager --disable remi-php54
yum-config-manager --enable remi-php70 && yum install php
yum-config-manager --enable remi-php71 && yum install php
yum-config-manager --enable remi-php72 && yum install php
yum-config-manager --enable remi-php73 && yum install php
yum-config-manager --enable remi-php74 # <---
#_------------- On Fedora -------------
dnf --enablerepo=remi install php70
dnf --enablerepo=remi install php73 #[Install PHP 7.3]
#_------ RHEL/CentOS 7/6------
yum search all php
#_------ Fedora / CENTOS 8------
dnf search all php
yum install httpd mariadb mariadb-server php php-common php-mysql php-gd php-xml php-mbstring php-mcrypt
systemctl start mariadb
mysql_secure_installation
systemctl enable mariadb
#yum --enablerepo=epel,remi install httpd
systemctl enable httpd.service
systemctl start httpd.service
systemctl start httpd
systemctl enable httpd
#__Then we will configure MariaDB to start automatically on system boot:
systemctl enable mariadb
#_rhel6
subscription-manager repos --enable=rhel-6-server-optional-rpms
#_rhel7
subscription-manager repos --enable=rhel-7-server-optional-rpms
#_Fedora 24-29
# rpm -Uvh http://rpms.remirepo.net/fedora/remi-release-29.rpm [On Fedora 29]
# rpm -Uvh http://rpms.remirepo.net/fedora/remi-release-28.rpm [On Fedora 28] dst
#_Fedora
dnf config-manager --set-enabled remi-php74
#CentOS 8,
php module usage
#_With Fedora modular and RHEL / CentOS 8, you can simply use the remi-7.4 stream of the php module
dnf module reset php
dnf module install php:remi-7.4
remi-php74 repository activation
#_PHP upgrade By choice, the packages have the same name than in the distribution, so a simple update is enough:
yum update
rpm -Uvh https://repo.mysql.com/mysql80-community-release-el7-1.noarch.rpm
#_default MySQL 8 repository is enabled for installation. To change edit repository
#_configuration file (/etc/yum.repos.d/mysql-community.repo) and enable/disable repositories as per requirements.
yum install mysql-server
systemctl enable mysqld.service
systemctl start mysqld.service
#_The installer generated a temporary password for MySQL root user and copied to log file. You can find this password
grep "A temporary password" /var/log/mysqld.log | tail -n1
#_[Some text hidden] A temporary password is generated for root@localhost: Eif;=YpBy2h#
mysql_secure_installation
Enter password for user root: [Enter password here found in log file]
The existing password for the user account root has expired. Please set a new password.
New password: [Enter new password]
Re-enter new password: [Re-enter new password]
Change the password for root? - n
Remove anonymous users? - y
Disallow root login remotely? - y
Remove test database and access to it? - y
Reload privilege tables now? - y
yum --enablerepo=epel,remi-php74 install php
yum --enablerepo=remi-php74 list php-*
yum --enablerepo=remi-php74 install php-mysql php-xml php-xmlrpc php-soap php-gd
After installing php and other php modules restart Apache service.
systemctl restart httpd.service
#___Allow Port in Firewall
Finally open firewall ports for HTTP (80) and HTTPS (443) services using the following command.
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
php -v
httpd -v
mysql -v
#Install Apache, composer, laravl langsung
yum --enablerepo=remi,epel install httpd
yum --enablerepo=remi,epel install mysql-server
service mysqld start
/usr/bin/mysql_secure_installation
yum --enablerepo=remi,epel install php php-zip php-mysql php-mcrypt php-xml php-mbstring
service httpd restart
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/bin/composer
chmod +x /usr/bin/composer
cd /var/www
git clone https://github.com/laravel/laravel.git
cd /var/www/laravel
composer install
chown -R apache.apache /var/www/laravel
chmod -R 755 /var/www/laravel
chmod -R 755 /var/www/laravel/storage
#_SELinux enabled systems also run the below command to allow write on storage directory.
chcon -R -t httpd_sys_rw_content_t /var/www/laravel/storage
cp .env.example .env
php artisan key:generate
Apache configuration file /etc/httpd/conf/httpd.conf
vim /etc/httpd/conf/httpd.conf
<VirtualHost *:80>
ServerName laravel.example.com
DocumentRoot /var/www/laravel/public
<Directory /var/www/laravel>
AllowOverride All
</Directory>
</VirtualHost>
#_centos_8
dnf install httpd -y
systemctl enable --now httpd
systemctl status httpd
firewall-cmd --add-service=http --permanent
firewall-cmd --reload
firewall-cmd --list-services
dnf info php
dnf install php
systemctl enable php-fpm
systemctl start php-fpm
systemctl status php-fpm
dnf search php-
php-gd.x86_64 : A module for PHP applications for using the gd graphics library
php-cli.x86_64 : Command-line interface for PHP
php-fpm.x86_64 : PHP FastCGI Process Manager
php-cli.x86_64 : Command-line interface for PHP
cd /var/www/html/
echo "<h1>hello world</h1>" > index.html
cd /var/www
mkdir superuser.web.id wpdev.web.id
echo "<h1>superuser.web.id</h1>" > superuser.web.id/index.html
echo "<h1>wpdev.web.id</h1>" > wpdev.web.id/index.html
cd /etc/httpd/conf.d/
vi superuser.web.id.conf
<VirtualHost *:80>
ServerName www.superuser.web.id
ServerAlias superuser.web.id
DocumentRoot /var/www/superuser.web.id
<Directory /var/www/superuser.web.id>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/httpd/superuser.web.id_error.log
CustomLog /var/log/httpd/superuser.web.id_access.log combined
</VirtualHost>
vi wpdev.web.id.conf
<VirtualHost *:80>
ServerName www.wpdev.web.id
ServerAlias wpdev.web.id
DocumentRoot /var/www/wpdev.web.id
<Directory /var/www/wpdev.web.id>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/httpd/wpdev.web.id_error.log
CustomLog /var/log/httpd/wpdev.web.id_access.log combined
</VirtualHost>
systemctl restart httpd
systemctl status httpd
# mysql -u root -p
Enter password:
## Create database ##
CREATE DATABASE wordpress;
## Creating new user ##
CREATE USER wordpress@localhost IDENTIFIED BY "secure_password";
## Grant privileges to database ##
GRANT ALL ON wordpress.* TO wordpress@localhost;
## FLUSH privileges ##
FLUSH PRIVILEGES;
## Exit ##
exit
cd /tmp && wget http://wordpress.org/latest.tar.gz
tar -xvzf latest.tar.gz -C /var/www/html
/var/www/html/wordpress
chown -R apache /var/www/html/wordpress
#Creating Apache Virtual Host for WordPress
vim /etc/httpd/conf/httpd.conf
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/wordpress
ServerName tecminttest.com
ServerAlias www.tecminttest.com
ErrorLog /var/log/httpd/tecminttest-error-log
CustomLog /var/log/httpd/tecminttest-acces-log common
</VirtualHost>
systemctl restart httpd
#_on ubuntu add vhost domain demo like www.wordpress.lan
$ sudo nano /etc/hosts
$ ping wordpress.lan
#_in windows C:\Windows\System32\drivers\etc
sudo apt-get install apache2 apache2-utils php libapache2-mod-php php-mysql php-curl php-gd php-intl php-mbstring php-soap php-xml php-xmlrpc php-zip mariadb-server mariadb-client
sudo apt-get install phpmyadmin
sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/
sudo mv /etc/apache2/conf-available/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
sudo a2enconf phpmyadmin
sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf.d/
sudo mv /etc/apache2/conf.d/apache.conf /etc/apache2/conf.d/phpmyadmin.conf
#_next step is to create a Virtual Host on the Apache web server
sudo nano /etc/apache2/sites-available/wordpress.conf
<VirtualHost *:80>
ServerName wordpress.lan
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
sudo a2ensite wordpress.conf
sudo systemctl reload apache2
#_To avoid that future Apache error concerning, ServerName FQDN missing open main configfile '/etc/apache2/apache2.conf',
ServerName wordpress.lan
sudo systemctl restart apache2
sudo mysql_secure_installation
sudo mysql -u root -p
CREATE DATABASE mysite;
GRANT ALL PRIVILEGES ON mysite.* TO 'mysiteadmin'@'localhost' IDENTIFIED BY 'SecureP@ssHere!';
FLUSH PRIVILEGES;
EXIT;
wget http://wordpress.org/latest.tar.gz
sudo tar xvzf latest.tar.gz
sudo cp -r wordpress/* /var/www/html
#_On Debian systems, run the following commands.
$ sudo tar xvzf latest.tar.gz
$ sudo mkdir -p /var/www/html
$ sudo cp -r wordpress/* /var/www/html
$ sudo service apache2 restart
$ sudo service mysql restart
$ sudo chown -R www-data /var/www/html
$ sudo chmod -R 755 /var/www/html
http://wordpress.lan/index.php
sudo chown -R root /var/www/html
#_Enable HTTPS on WordPress
$ sudo apt-get update
$ sudo apt-get install software-properties-common
$ sudo add-apt-repository universe
$ sudo apt-get update
$ sudo apt-get install certbot python3-certbot-nginx
$ sudo certbot --apache
#_you can check your site’s HTTPS at https://www.ssllabs.com/ssltest/.
yum list php
yum install httpd
systemctl enable httpd
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
#_Install repository Remi. Repository Remi ini menyediakan PHP versi 5.4, 7.0, 7.1, dan 7.2.
#_Perintah install repository di bawah ini akan menambah file .repo di /etc/yum.repos.d.
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
ls -l /etc/yum.repos.d
yum install yum-utils
yum-config-manager --enable remi-php70
yum info php
yum install php php-common
systemctl restart httpd
nano /var/www/html/info.php
#_php_di_ubuntu Install Apache and FastCGI module.
sudo apt update
sudo apt install apache2 libapache2-mod-fcgid -y
#_Install PHP and PHP-FPM.
sudo apt install php php-fpm -y
sudo systemctl status php7.4-fpm
sudo a2enmod actions fcgid alias proxy_fcgi
sudo nano /etc/apache2/sites-available/000-default.conf
<FilesMatch \.php$>
SetHandler "proxy:unix:/var/run/php/php7.4-fpm.sock|fcgi://localhost"
</FilesMatch>
sudo systemctl restart apache2
sudo systemctl status apache2
#_Access http://localhost/info.php or http://serverIP/info.php. In the Server API the value is FPM/FastCGI.
sudo echo "<?php phpinfo(); ?>" > /var/www/html/info.php
Server requirements that must be met to run Laravel 8:
PHP > 7.3_!_BCMath PHP Extension_!_Ctype PHP Extension_!_Fileinfo PHP extension_!_JSON PHP Extension
Mbstring PHP Extension_!_OpenSSL PHP Extension_!_PDO PHP Extension_!_Tokenizer_PHP_Extension_!_XML PHP Extension
sudo apt install composer
sudo apt install php php-common php-bcmath php-mbstring php-mysql php-tokenizer php-zip
#_Install Laravel 8.0 using Composer and save it in the /home/user/public_html/blog
mkdir ~/public_html
cd ~/public_html
composer create-project laravel/laravel blog 8.0
composer create-project laravel/laravel blog
cd blog
php artisan serve
#_Browse http://127.0.0.1:8000 atau http://localhost:8000.
sudo apt install apache2 libapache2-mod-php
sudo systemctl restart apache2
sudo systemctl status apache2
#_URL http://127.0.0.1:8000 can be changed to a hostname or local domain using Apache virtual host & the file /etc/hosts.
<VirtualHost *:80>
ServerName laravel.web
DocumentRoot /home/user/public_html/blog/public
<Directory /home/user/public_html/blog/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/laravel.web_error.log
CustomLog /var/log/apache2/laravel.web_access.log combined
</VirtualHost>
sudo a2ensite laravel.web.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
sudo chown -R $USER:www-data /home/user/public_html/blog
sudo chmod -R 775 /home/user/public_html/blog
sudo nano /etc/hosts
127.0.0.1 laravel.web @@
sudo apt install build-essential curl file git
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
Make homebrew available in the system environment:
test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
test -r ~/.bash_profile && echo eval" ($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile
echo "eval $($(brew --prefix)/bin/brew shellenv)" >>~/.profile
Install the dependency package for mkcert:
sudo apt install libnss3-tools
brew install mkcert
mkcert -install
#_Create an SSL certificate for laravel.web:
mkcert laravel.web
sudo mkdir /etc/apache2/ssl
sudo mv laravel.web*.pem /etc/apache2/ssl
sudo nano /etc/apache2/sites-available/laravel.web.conf
<VirtualHost *:80>
ServerName laravel.web
RewriteEngine on
RewriteCond %{SERVER_NAME} =laravel.web
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName laravel.web
DocumentRoot /home/user/public_html/blog/public
<Directory /home/user/public_html/blog/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/laravel.web_error.log
CustomLog /var/log/apache2/laravel.web_access.log combined
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/laravel.web.pem
SSLCertificateKeyFile /etc/apache2/ssl/laravel.web-key.pem
</VirtualHost>
</IfModule>
sudo a2enmod ssl
sudo systemctl restart apache2
Browse https://laravel.web.
sudo apt install mariadb-server
sudo mysql_secure_installation
Enter current password for root (enter for none): ENTER
Set root password? [Y/n] y
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
sudo mysql -u root -p
CREATE DATABASE blog;
CREATE USER 'userblog'@'localhost' IDENTIFIED BY 'passblog';
GRANT ALL PRIVILEGES ON blog.* TO 'userblog'@'localhost';
FLUSH PRIVILEGES;
EXIT;
nano ~/public_html/blog/.env
DB_DATABASE=blog
DB_USERNAME=userblog
DB_PASSWORD=passblog
php artisan migrate
Install laravel/jetstream:
composer require laravel/jetstream
composer update
Install livewire:
php artisan jetstream:install livewire
#_laravel_apache_ubuntu
sudo apt install composer
sudo apt install php php-common php-bcmath php-mbstring php-mysql php-tokenizer php-zip
mkdir ~/public_html
cd ~/public_html
composer create-project laravel/laravel blog 8.0
composer create-project laravel/laravel blog
cd blog
php artisan serve
http://127.0.0.1:8000 atau http://localhost:8000.
sudo apt install apache2 libapache2-mod-php
sudo apt install apache2 libapache2-mod-php
sudo systemctl restart apache2
sudo systemctl status apache2
hostname atau local domain dengan menggunakan Apache virtual host dan file /etc/hosts.
laravel.web:
sudo nano /etc/apache2/sites-available/laravel.web.conf
<VirtualHost *:80>
ServerName laravel.web
DocumentRoot /home/musaamin/public_html/blog/public
<Directory /home/musaamin/public_html/blog/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/laravel.web_error.log
CustomLog /var/log/apache2/laravel.web_access.log combined
</VirtualHost>
sudo a2ensite laravel.web.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
sudo chown -R $USER:www-data /home/musaamin/public_html/blog
sudo chmod -R 775 /home/musaamin/public_html/blog
sudo nano /etc/hosts
127.0.0.1 laravel.web
sudo apt install build-essential curl file git
#_Download dan jalankan installer Homebrew:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
test -r ~/.bash_profile && echo eval" ($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile
echo "eval $($(brew --prefix)/bin/brew shellenv)" >>~/.profile
brew install mkcert
#_Install Certificate Authority (CA):
mkcert -install
mkcert laravel.web
sudo mkdir /etc/apache2/ssl
sudo mv laravel.web*.pem /etc/apache2/ssl
sudo nano /etc/apache2/sites-available/laravel.web.conf
<VirtualHost *:80>
ServerName laravel.web
RewriteEngine on
RewriteCond %{SERVER_NAME} =laravel.web
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName laravel.web
DocumentRoot /home/musaamin/public_html/blog/public
<Directory /home/musaamin/public_html/blog/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/laravel.web_error.log
CustomLog /var/log/apache2/laravel.web_access.log combined
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/laravel.web.pem
SSLCertificateKeyFile /etc/apache2/ssl/laravel.web-key.pem
</VirtualHost>
</IfModule>
sudo a2enmod ssl
sudo systemctl restart apache2
sudo mysql_secure_installation
Enter current password for root (enter for none): ENTER
Set root password? [Y/n] y
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
sudo mysql -u root -p
CREATE DATABASE blog;
CREATE USER 'userblog'@'localhost' IDENTIFIED BY 'passblog';
GRANT ALL PRIVILEGES ON blog.* TO 'userblog'@'localhost';
FLUSH PRIVILEGES;
EXIT;
#_Buka file .env:
nano ~/public_html/blog/.env
Konfigurasi koneksi database:
DB_DATABASE=blog
DB_USERNAME=userblog
DB_PASSWORD=passblog
php artisan migrate
Memasang laravel/jetstream:
composer require laravel/jetstream
composer update
php artisan jetstream:install livewire
#_install_ioncube................................
yum install httpd php php-cli
systemctl enable httpd
systemctl start httpd
systemctl status httpd
curl -O https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar xzvf ioncube_loaders_lin_x86-64.tar.gz
ls ioncube
php -i | grep extension_dir
extension_dir => /usr/lib64/php/modules => /usr/lib64/php/modules
Copy ionCube Loader 5.4 ke extension directory.
cp ioncube/ioncube_loader_lin_5.4.so /usr/lib64/php/modules
#_Masukkan ionCube Loader ke dalam konfigurasi PHP.
vi /etc/php.ini
#_Masukkan opsi di bawah ini ke dalam file php.ini.
zend_extension = /usr/lib64/php/modules/ioncube_loader_lin_5.4.so
Restart Apache web server.
systemctl restart httpd
php -v
#_Here are the packages that we will install. Please keep in mind that MySQL 8 connectors (PHP, Perl, Python, Java, etc.) #_will work unchanged with MariaDB as both systems use the same client protocol & the client lib are binary compatible.
yum-config-manager --enable remi-php72 && yum install php
yum-config-manager --enable remi-php73 && yum install php
yum search php
yum install php php-mysql php-pdo php-gd php-mbstring
#echo "<?php phpinfo(); ?>" > /var/www/html/info.php
#systemctl restart httpd
#_if you get an error on PHP Date & Timezone, open php.ini config file https://www.php.net/manual/en/timezones.php
#_search and uncomment date.timezone statement, append your physical location & restart Apache daemon.
nano /etc/php.ini
date.timezone = Continent/City
#_centos7
yum --enablerepo=remi install php-mysqlnd php-pgsql php-pecl-mongo php-pdo php-pecl-memcache php-pecl-memcached php-gd php-xml php-mbstring php-mcrypt php-pecl-apcu php-cli php-pear
#_centos8
dnf --enablerepo=remi install php-mysqlnd php-pgsql php-pecl-mongo php-pdo php-pecl-memcache php-pecl-memcached php-gd php-xml php-mbstring php-mcrypt php-pecl-apcu php-cli php-pear
MariaDB/MySQL (php-mysql) – a dynamic shared object that will add MariaDB support to PHP.
PostgreSQL (php-pgsql) – PostgreSQL database support for PHP.
MongoDB (php-pecl-mongo) – An interface for communicating with the MongoDB database in PHP.
Generic (php-pdo) – A dynamic shared object that will add a database access abstraction layer to PHP.
Memcache (php-pecl-memcache) – Memcached is a caching daemon designed especially for dynamic web applications to decrease database load by storing objects in memory.
Memcached (php-pecl-memcached) An extension that uses the libmemcached lib to provide API for communicating with memcached servers.
GD (php-gd) – A dynamic share object that adds support for using the gd graphics library to PHP.
XML (php-xml) – A dynamic shared objects that adds support to PHP for manipulating XML documents.
MBString (php-mbstring) – An extension to handle multi-byte string in PHP applications.
MCrypt (php-mcrypt) – A Mcrypt library for PHP scripts.
APC (php-pecl-apcu) – APC module used to optimize and cache PHP code.
CLI (php-cli) – Command-line interface for PHP.
PEAR (php-pear) – Application Repository framework for PHP.
Install these following necessary PHP modules with the command below.
#_
rpm -Uvh https://repo.mysql.com/mysql80-community-release-el7-1.noarch.rpm [On RHEL/CentOS 7]
# rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el6-1.noarch.rpm [On RHEL/CentOS 6]
# rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-fc29-1.noarch.rpm [On Fedora 29]
# rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-fc28-1.noarch.rpm [On Fedora 28]
#_After installing the MySQL Yum repofor your Linux platform, now install the latest version (currently 8.0)
yum install mysql-community-server [On RHEL/CentOS]
# dnf install mysql-community-server [On Fedora]
service mysqld start
yum install httpd
#systemctl status|start|stop|restart|reload httpd
#service httpd status|start|stop|restart|reload
#apachectl configtest| graceful
#_Apache DocumentRoot path it’s set to /var/www/html
nano /etc/httpd/conf.d/welcome.conf
systemctl restart httpd
# systemctl start httpd
# systemctl enable httpd
# systemctl status httpd
#_Apache Virtual Hosts in RHEL/CentOS 7
cd /etc/httpd/
mkdir sites-available sites-enabled
nano conf/httpd.conf
on httpd.conf in /etc/httpd/sites-enabled
IncludeOptional sites-enabled/*.conf
nano /etc/httpd/sites-available/rheltest.lan.conf
<VirtualHost *:80>
ServerName rheltest.lan
DocumentRoot "/var/www/rheltest.lan"
<Directory "/var/www/rheltest.lan">
Options Indexes FollowSymLinks MultiViews
# AllowOverride controls what directives may be placed in .htaccess files.
AllowOverride All
# Controls who can get stuff from this server file
Order allow,deny
Allow from all
</Directory>
<IfModule mpm_peruser_module>
ServerEnvironment apache apache
</IfModule>
ErrorLog /var/log/httpd/rheltest.lan-error.log
CustomLog /var/log/httpd/rheltest.lan-access.log combined
</VirtualHost>
#_time to create a2ensite & a2dissite bash scripts on a executable system path-in this case is /usr/local/bin/ – but
#_you can use any executable path that $PATH system variable outputs. Create a2ensite Script
nano /usr/local/bin/a2ensite
#---------------------------
#!/bin/bash
if test -d /etc/httpd/sites-available && test -d /etc/httpd/sites-enabled ;
then
echo "-----------------------------------------------"
else
mkdir /etc/httpd/sites-available
mkdir /etc/httpd/sites-enabled
fi
avail=/etc/httpd/sites-available/$1.conf
enabled=/etc/httpd/sites-enabled/
site='ls /etc/httpd/sites-available/'
if [ "$#" != "1" ]; then
echo "Use script: a2ensite virtual_site"
echo -e "\nAvailable virtual hosts:\n$site"
exit 0
else
if test -e $avail; then
sudo ln -s $avail $enabled
else
echo -e "$avail virtual host does not exist! Please create one!\n$site"
exit 0
fi
if test -e $enabled/$1.conf; then
echo "Success!! Now restart Apache server: sudo systemctl restart httpd"
else
echo -e "Virtual host $avail does not exist!\nPlease see available virtual hosts:\n$site"
exit 0
fi
fi
#--------------------
#_Create a2dissite Script
nano /usr/local/bin/a2dissite
#------------------
#!/bin/bash
avail=/etc/httpd/sites-enabled/$1.conf
enabled=/etc/httpd/sites-enabled
site='ls /etc/httpd/sites-enabled/'
if [ "$#" != "1" ]; then
echo "Use script: a2dissite virtual_site"
echo -e "\nAvailable virtual hosts: \n$site"
exit 0
else
if test -e $avail; then
sudo rm $avail
else
echo -e "$avail virtual host does not exist! Exiting!"
exit 0
fi
if test -e $enabled/$1.conf; then
echo "Error!! Could not remove $avail virtual host!"
else
echo -e "Success! $avail has been removed!\nPlease restart Apache: sudo systemctl restart httpd"
exit 0
fi
fi
#-------------
chmod +x /usr/local/bin/a2*
a2ensite vhost_name
a2disite vhost_name
#_To test it, enable the virtual host created earlier, restart Apache then load http://rheltest.lan.
a2ensite rheltest.lan
systemctl restart httpd
#_That’s it! Now you can use a2eniste and a2dissite bash scripts as system commands to manage Apache Vhosts
#_Lets set up Name Based Virtual Hosting and IP based Virtual hosting in RHEL, CentOS and Fedora.
#_OS – CentOS 6.5
#_Application – Apache Web Server
#_IP Address – 192.168.0.100
#_IP Address – 192.168.0.101
#_Domain – www.example1.com
#_Domain – www.example2.com
#_before creating a virtual host, you need to create a directory
mkdir /var/www/html/example1.com/
mkdir /var/www/html/example1.com/
vi /etc/httpd/conf/httpd.conf
NameVirtualHost 192.168.0.100:80 @@
#_move to the bottom of the file by pressing Shift + G
<VirtualHost 192.168.0.100:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/example1.com
ServerName www.example1.com
ErrorLog logs/www.example1.com-error_log
CustomLog logs/www.example1.com-access_log common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/example2.com
ServerName www.example2.com
ErrorLog logs/www.example2.com-error_log
CustomLog logs/www.example2.com-access_log common
</VirtualHost>
[root@tecmint ~]# httpd -t
Syntax OK
service httpd restart
#_If syntax is OK. Please restart your Web server and add it to chkconfig
#_to make your web server start in runlevel 3 and 5 at the boot time only.
chkconfig --level 35 httpd on
[root@tecmint ~]# vi /var/www/html/example1.com/index.html
<html><head><title>www.example1.com</title></head><body><h1>Hello, Welcome to www.exa1.com.</h1></body></html>
[root@tecmint ~]# vi /var/www/html/example2.com/index.html
<html><head><title>www.example2.com</title></head><body><h1>Hello, Welcome to www.exa2.com.</h1></body></html>
http://www.example1.com
http://www.example2.com
#_To setup IP based virtual hosting, you must have more than one IP address/Port assigned to your server or your Linux
#_It can be on a single NIC card , For example: eth0:1, eth0:2, eth0:3 … so forth. Multiple NIC cards can also be #_attached. If you don’t know how to create multiple IP’s on single NIC, follow the below guide, that will help you
#_As you can see in above output, two IPs 192.168.0.100 (eth0) and 192.168.0.101 (eth0:1) is attached to the server, #_both IPs are assigned to the same physical network device (eth0). Search for word "Listen" on httpd.conf ,
[root@tecmint ~]# vi /etc/httpd/conf/httpd.conf
# Listen 80
Listen 192.168.0.100:80
#_Now, create a Virtual host sections for both the domains. Go the bottom of the file
<VirtualHost 192.168.0.100:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/example1
ServerName www.example1.com
ErrorLog logs/www.example1.com-error_log
TransferLog logs/www.example1.com-access_log
</VirtualHost>
<VirtualHost 192.168.0.101:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/example2
ServerName www.example2.com
ErrorLog logs/www.example2.com-error_log
TransferLog logs/www.example2.com-access_log
</VirtualHost>
service httpd restart
#_Installing MariaDB 10 Database Server
vi /etc/yum.repos.d/mariadb.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
#_------ On RHEL/CentOS 7 ------
yum --enablerepo=remi install httpd MariaDB-client MariaDB-server
#_------ On Fedora / CENTOS 8------
dnf --enablerepo=remi install httpd MariaDB-client MariaDB-server
systemctl enable httpd
systemctl enable mariadb
systemctl start httpd
systemctl start mariadb
#_On SysVinit
chkconfig --levels 235 httpd on
chkconfig --levels 235 mysqld on
#------ Start Apache and MySQL ------
/etc/init.d/httpd start
/etc/init.d/mysqld start
yum install mariadb-server mariadb
systemctl start mariadb
mysql_secure_installation
systemctl enable mariadb
#_by default official RHEL 7.0 or CentOS 7.0 repositories doesn’t provide PHPMYADMIN
#_install PhpMyAdmin package by enabling CentOS 7.0 rpmforge repositories using the following command.
yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm
yum install phpmyadmin
nano /etc/httpd/conf.d/phpmyadmin.conf
Order Deny,Allow @@
Deny from all @@
Allow from 127.0.0.1 @@
#_To be able to login to PhpMyAdmin Web interface using cookie authentication method
#_add a blowfish string to phpmyadmin config.inc.php file using the generate a secret string, restart Apache Web
$cfg['blowfish_secret'] = 'ftwetwe94892fwbc'; @@
#_postgres
sudo yum repolist
sudo yum search postgresql13
sudo yum -y install postgresql13 postgresql13-server
sudo /usr/pgsql-13/bin/postgresql-13-setup initdb
sudo systemctl start postgresql-13
sudo systemctl status postgresql-13
sudo systemctl enable postgresql-13
sudo su - postgres
psql -c "alter user postgres with password 'FromVarRead'" !!!!
sudo vi /var/lib/pgsql/13/data/postgresql.conf
listen_addresses = '172.20.11.11' @@@
sudo vi /var/lib/pgsql/13/data/pg_hba.conf
# Accept from anywhere (not recommended)
host all all 0.0.0.0/0 md5 @@
# Accept from trusted subnet (Recommended setting)
host all all 172.20.11.0/24 md5 @@
sudo systemctl restart postgresql-13
sql -U <dbuser> -h <serverip> -p 5432 <dbname> @@
#_postgresInCentos8
dnf module list postgresql
Output>>>
postgresql 9.6 client, server [d]
postgresql 10 [d] client, server [d]
postgresql 12 client, server
sudo dnf module enable postgresql:12
#_When prompted, press y and then ENTER to confirm that you want to enable the stream:
#_After enabling the version 12 module stream, you can install the postgresql-server package to install PostgreSQL 12
sudo dnf install postgresql-server
#_Creating a New PostgreSQL Database Cluster
#_ To create a database cluster, run the script using sudo and with the --initdb option:
sudo postgresql-setup --initdb
* Initializing database in '/var/lib/pgsql/data'
* Initialized, logs are in /var/lib/pgsql/initdb_postgresql.log
sudo systemctl start postgresql
sudo systemctl enable postgresql
#_ Created symlink /etc/systemd/system/multi-user.target.wants/postgresql.service → /usr/lib/systemd/system/postgresql.service.
sudo -i -u postgres
sudo -u postgres psql
#_If you are logged in as the postgres account, you can create a new user by typing:
createuser --interactive
#_The script will prompt you with some choices and, based on your responses, execute the necessary Postgres commands
sudo -u postgres createuser --interactive
Output >>
#_Enter name of role to add: sammy
#_Shall the new role be a superuser? (y/n) y
man createuser
createdb sammy
sudo -u postgres createdb sammy
sudo adduser sammy
#_Once this new account is available, you can either switch over and then connect to the database by first typing:
sudo -i -u sammy
psql
sudo -u sammy psql
psql -d postgres
Once logged in, you can check your current connection information by typing:
\conninfo
Output >>
#_You are connected to database "sammy" as user "sammy" via socket in "/var/run/postgresql" at port "5432".
CREATE TABLE table_name (
column_name1 col_type (field_length) column_constraints,
column_name2 col_type (field_length),
column_name3 col_type (field_length)
);
CREATE TABLE playground (
equip_id serial PRIMARY KEY,
type varchar (50) NOT NULL,
color varchar (25) NOT NULL,
location varchar(25) check (location in ('north', 'south', 'west', 'east', 'northeast', 'southeast', 'southwest', 'northwest')),
install_date date
);
\d
INSERT INTO playground (type, color, location, install_date) VALUES ('slide', 'blue', 'south', '2017-04-28');
INSERT INTO playground (type, color, location, install_date) VALUES ('swing', 'yellow', 'northwest', '2018-08-16');
SELECT * FROM playground;
DELETE FROM playground WHERE type = 'slide';
#_After creating a table, you can modify it to add or remove columns. Add a column to show the last maintenance visit
ALTER TABLE playground ADD last_maint date;
SELECT * FROM playground;
#_Deleting a column is just as simple. If you find a separate tool to keep track of maintenance history
ALTER TABLE playground DROP last_maint;
UPDATE playground SET color = 'red' WHERE type = 'swing';
https://www.tecmint.com/install-pgadmin4-in-centos-7/
yum -y install pgadmin4
mv /etc/httpd/conf.d/pgadmin4.conf.sample /etc/httpd/conf.d/pgadmin4.conf
vi /etc/httpd/conf.d/pgadmin4.conf
<VirtualHost *:80>
LoadModule wsgi_module modules/mod_wsgi.so
WSGIDaemonProcess pgadmin processes=1 threads=25
WSGIScriptAlias /pgadmin4 /usr/lib/python2.7/site-packages/pgadmin4-web/pgAdmin4.wsgi
<Directory /usr/lib/python2.7/site-packages/pgadmin4-web/>
WSGIProcessGroup pgadmin
WSGIApplicationGroup %{GLOBAL}
<IfModule mod_authz_core.c>
# Apache 2.4
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
</VirtualHost>
#_Next we will create logs and lib directories for pgAdmin4 and set their ownership:
mkdir -p /var/lib/pgadmin4/
mkdir -p /var/log/pgadmin4/
chown -R apache:apache /var/lib/pgadmin4
chown -R apache:apache /var/log/pgadmin4
vi /usr/lib/python2.7/site-packages/pgadmin4-web/config_distro.py
#_And add the following lines:
LOG_FILE = '/var/log/pgadmin4/pgadmin4.log'
SQLITE_PATH = '/var/lib/pgadmin4/pgadmin4.db'
SESSION_DB_PATH = '/var/lib/pgadmin4/sessions'
STORAGE_DIR = '/var/lib/pgadmin4/storage'
#_Finally we will create our user account, with which we will authenticate in the web interface. To do this, run:
python /usr/lib/python2.7/site-packages/pgadmin4-web/setup.py
http://ip-address/pgadmin4 or http://localhost/pgadmin
#_If you receive 403 error while accessing PgAdmin4 interface, you need to set the correct SELinux context on the
chcon -t httpd_sys_rw_content_t /var/log/pgadmin4 -R
chcon -t httpd_sys_rw_content_t /var/lib/pgadmin4 -R
#_At your first login, you will need to add a new server to manage. Click on “Add New Server”. You will need to configure #_the PostgresQL connection. In the first tab “General”, enter the following settings:
#_Name – give name of the server you are configuring.
#_Comment – leave a comment to give description of the instance.
systemctl status firewalld
firewall-cmd --state
dnf install firewalld
systemctl start firewalld
systemctl enable firewalld
systemctl status firewalld
firewall-cmd --state
firewall-cmd --get-zones
firewall-cmd --list-all-zones
firewall-cmd --get-active-zones
firewall-cmd --get-default-zone
#_Menampilkan konfigurasi satu zone, misalnya public.
firewall-cmd --zone=public --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: enp0s3 enp0s8
sources:
services: cockpit dhcpv6-client ssh
ports:
protocols:
masquerade: no
forward-ports:
#_Konfigurasi public zone di atas hanya mengijinkan service yang terdaftar yaitu cockpit, dhcpv6-client, dan ssh.
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --reload
firewall-cmd --zone=public --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: enp0s3 enp0s8
sources:
services: cockpit dhcpv6-client http ssh
firewall-cmd --get-services
#_Menghapus service dari zone gunakan remove.
firewall-cmd --zone=public --remove-service=http
#_Misalnya kita ingin mengijinkan akses ke port nomor 5000 untuk protokol TCP dan UDP.
firewall-cmd --zone=public --add-port=5000/tcp --permanent
firewall-cmd --zone=public --add-port=5000/udp --permanent
firewall-cmd --reload
firewall-cmd --zone=public --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: enp0s3 enp0s8
sources:
services: cockpit dhcpv6-client http ssh
ports: 5000/tcp 5000/udp
protocols:
masquerade: no
firewall-cmd --zone=public --list-ports
5000/tcp 5000/udp
firewall-cmd --zone=public --remove-port=5000/tcp --permanent
firewall-cmd --zone=public --remove-port=5000/udp --permanent
firewall-cmd --reload
firewall-cmd --add-service=http --permanent
firewall-cmd --reload
firewall-cmd --list-services
#_If you are running firewalld, make sure to allow Apache traffic on the firewall.
# firewall-cmd --zone=public --permanent --add-service=http
# firewall-cmd --zone=public --permanent --add-service=https
# firewall-cmd --reload
firewall-cmd --add-service=http
firewall-cmd --permanent --add-service=http
systemctl restart firewalld
# firewall-cmd --state
# firewall-cmd --list-all
# firewall-cmd --list-interfaces
# firewall-cmd --get-service
# firewall-cmd --query-service service_name
# firewall-cmd --add-port=8080/tcp
centos8
https://musaamin.web.id/cara-install-php-dengan-nginx-di-centos-8/
dnf install nginx
systemctl enable --now nginx
systemctl start nginx
systemctl status nginx
firewall-cmd --add-service=http --permanent
firewall-cmd --reload
firewall-cmd --list-services
dnf install php php-mysqlnd php-pdo php-gd php-mbstring
systemctl enable php-fpm
systemctl start php-fpm
systemctl status php-fpm
cd /usr/share/nginx/html
echo "<?php phpinfo(); ?>" > info.php #_Lalu browsing http://ip-server/info.php.
#_Buat Document Root terlebih dahulu dan file testing PHP.
mkdir /var/www/superuser.web.id
echo "<?php phpinfo(); ?>" > /var/www/superuser.web.id
vi /etc/nginx/conf.d/superuser.web.id.conf
server {
listen 80;
server_name superuser.web.id;
root /var/www/superuser.web.id;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $fastcgi_script_name =404;
include fastcgi_params;
fastcgi_pass unix:/run/php-fpm/www.sock;
fastcgi_index index.php;
fastcgi_param DOCUMENT_ROOT $realpath_root;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
}
access_log /var/log/nginx/superuser.web.id.access.log;
error_log /var/log/nginx/superuser.web.id.error.log warn;
}
systemctl restart nginx
systemctl status nginx
#_ cari nama paketnya dengan perintah dnf search.
dnf search php-
php-gd.x86_64 : A module for PHP applications for using the gd graphics library
php-cli.x86_64 : Command-line interface for PHP
php-fpm.x86_64 : PHP FastCGI Process Manager
php-cli.x86_64 : Command-line interface for PHP
systemctl enable --now nginx
systemctl start nginx
systemctl status nginx
firewall-cmd --add-service=http --permanent
firewall-cmd --reload
firewall-cmd --list-services
https://usaamin.web.id/cara-install-php-7-4-di-centos-8/
dnf install epel-release -y
dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm -y
dnf module list php
dnf module enable php:remi-7.4
dnf install php php-cli php-common
systemctl enable httpd
systemctl start httpd
systemctl status httpd
#_Cek status php-fpm service, karena CentOS 8 tidak pakai Apache module. Install PHP tadi jadi menginstall PHP-FPM.
systemctl enable php-fpm
systemctl status php-fpm
UBUNT
-----------------------------
https://saamin.web.id/how-to-install-laravel-8-on-ubuntu-2004/
Server requirements that must be met to run Laravel 8:
PHP >= 7.3
BCMath PHP Extension
Ctype PHP Extension
Fileinfo PHP extension
JSON PHP Extension
Mbstring PHP Extension
OpenSSL PHP Extension
PDO PHP Extension
Tokenizer PHP Extension
XML PHP Extension
sudo apt install composer
sudo apt install php php-common php-bcmath php-mbstring php-mysql php-tokenizer php-zip
mkdir ~/public_html
cd ~/public_html
composer create-project laravel/laravel blog 8.0
composer create-project laravel/laravel blog
cd blog
php artisan serve
#_Starting Laravel development server: http://127.0.0.1:8000
sudo apt install apache2 libapache2-mod-php
sudo systemctl restart apache2
sudo systemctl status apache2
sudo nano /etc/apache2/sites-available/laravel.web.conf
<VirtualHost *:80>
ServerName laravel.web
DocumentRoot /home/user/public_html/blog/public
<Directory /home/user/public_html/blog/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/laravel.web_error.log
CustomLog /var/log/apache2/laravel.web_access.log combined
</VirtualHost>
sudo a2ensite laravel.web.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
sudo chown -R $USER:www-data /home/user/public_html/blog
sudo chmod -R 775 /home/user/public_html/blog
sudo nano /etc/hosts
127.0.0.1 laravel.web
sudo apt install build-essential curl file git
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
Test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
test -r ~/.bash_profile && echo eval" ($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile
echo "eval $($(brew --prefix)/bin/brew shellenv)" >>~/.profile
sudo apt install libnss3-tools
brew install mkcert
mkcert -install
mkcert laravel.web
sudo mkdir /etc/apache2/ssl
sudo mv laravel.web*.pem /etc/apache2/ssl
Open the laravel.web virtual host configuration file:
sudo nano /etc/apache2/sites-available/laravel.web.conf
<VirtualHost *:80>
ServerName laravel.web
RewriteEngine on
RewriteCond %{SERVER_NAME} =laravel.web
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName laravel.web
DocumentRoot /home/user/public_html/blog/public
<Directory /home/user/public_html/blog/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/laravel.web_error.log
CustomLog /var/log/apache2/laravel.web_access.log combined
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/laravel.web.pem
SSLCertificateKeyFile /etc/apache2/ssl/laravel.web-key.pem
</VirtualHost>
</IfModule>
sudo a2enmod ssl
sudo systemctl restart apache2
sudo apt install mariadb-server
sudo mysql_secure_installation
Enter current password for root (enter for none): ENTER
Set root password? [Y/n] y
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
sudo mysql -u root -p
CREATE DATABASE blog;
CREATE USER 'userblog'@'localhost' IDENTIFIED BY 'passblog';
GRANT ALL PRIVILEGES ON blog.* TO 'userblog'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Open the .env file:
nano ~/public_html/blog/.env
DB_DATABASE=blog
DB_USERNAME=userblog
DB_PASSWORD=passblog
Run migrate to create a user table:
php artisan migrate
composer require laravel/jetstream
composer update
php artisan jetstream:install livewire
===============================================
CENTOS .......
https://www.dewaweb.com/blog/cara-install-lamp-stack-di-centos-7/
Sebelum memulainya, perlu instalasi Firewall supaya lebih secure.
Pada Firewall ini menggunakan CSF (ConfigServer Security & Firewall).
Sekilas Tentang CSF
CSF adalah Stateful Packet Ispection Firewall, Login dan Intrusion Detection & Security Application
untuk Linux Server.
cd /usr/src
wget https://download.configserver.com/csf.tgz
tar -xzf csf.tgz
cd csf
sh install.sh
nano /etc/csf/csf.conf
csf -r *RESTART ...
Berikut ini cara install LAMP Stack di CentOS 7:
Step 1 – Add Repository
Login sebagai root dan add repository EPEL dengan command di bawah ini:
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
yum install epel-release -y
yum install mariadb-server mariadb -y
systemctl start mariadb.service
systemctl enable mariadb.service
mysql_secure_installation
Enter current password for root (enter for none): <= [ENTER]
OK, successfully used password, moving on...
Set root password? [Y/n] y
New password: <= [Masukan Password root MySQL]
Re-enter new password: <= [Masukan Password root MySQL]
Password updated successfully!
Reloading privilege tables..
... Success!
Remove anonymous users? [Y/n] y
... Success!
Disallow root login remotely? [Y/n] y
... Succes!
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reload privilege tables now? [Y/n] y
... Success!
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Install web server Apache sesuai dengan LAMP Stack. Untuk saat ini Apache versi terbaru adalah 2.4.
Start dan enable Apache untuk start on-boot.
yum install httpd -y
systemctl start httpd
systemctl enable httpd
Lakukan instalasi PHP untuk memproses script website untuk ditampilkan menjadi sebuah konten.
Tambahkan Remi CentOS Repository.
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum install yum-utils -y
yum update -y
yum-config-manager --enable remi-php70
yum install php php-opcache -y
systemctl restart httpd.service ** Restart Apache untuk memperbaharui perubahan.
https://www.dewaweb.com/blog/cara-install-lamp-stack-di-centos-7/
https://www.dewaweb.com/blog/cara-instalasi-lamp-stack-di-centos-8/
Control panel tak selalu perlu digunakan untuk mengelola website pribadi di VPS atau cloud server, hal ini dapat dilakukan jika kamu sudah memiliki pengalaman pada Linux atau menjadi system administrator, karena nantinya akan penuh dengan CLI (Command Line Interface) tidak ada GUI seperti cPanel atau CWP pada umumnya. Pada artikel ini kami akan membahas mengenai cara instalasi LAMP Stack di CentOS 8.
DNF atau Dandified YUM merupakan generasi terbaru dari package manager untuk distribusi berbasis .rpm yang dirilis pada 2018. Pada command atau perintah di CentOS 8 ini, kita akan lebih banyak menggunakan DNF.
Sebelum mulai mempraktikkan cara instalasi LEMP Stack, pastikan kamu sudah memenuhi beberapa persyaratan berikut:
VPS dengan OS CentOS 8.
Domain yang sudah diarahkan ke alamat IP VPS. (Dewaweb juga menyediakan hosting murah gratis domain)
Akses root.
Update Packages CentOS 8
Kamu perlu melakukan update package pada CentOS 8 terlebih dulu menggunakan perintah DNF, kemudian reboot server.
dnf update
reboot
dnf install httpd httpd-tools -y
systemctl enable httpd
systemctl start httpd
systemctl status httpd
Setelah instalasi web server, untuk mendapatkan versi terbaru dari Apache,
kamu bisa menggunakan command di bawah ini:
rpm -qi httpd
Name : httpd
Version : 2.4.37
Release : 16.module_el8.1.0+256+ae790463
Architecture: x86_64
Install Date: Thu 21 May 2020 06:44:49 AM UTC
Group : System Environment/Daemons
Size : 5611291
License : ASL 2.0
Signature : RSA/SHA256, Mon 23 Dec 2019 10:22:02 PM UTC, Key ID 05b555b38483c65d
Source RPM : httpd-2.4.37-16.module_el8.1.0+256+ae790463.src.rpm
Build Date : Mon 23 Dec 2019 08:46:30 PM UTC
Build Host : x86-02.mbox.centos.org
Relocations : (not relocatable)
Packager : CentOS Buildsys <[email protected]>
Vendor : CentOS
URL : https://httpd.apache.org/
Summary : Apache HTTP Server
Description :
The Apache HTTP Server is a powerful, efficient, and extensible
web server.
Di sini kami menggunakan MariaDB sebagai Database di LAMP Stack ini, karena MySQL saat ini sudah deprecated alias tidak up-to-date.
dnf install mariadb-server mariadb -y
systemctl start mariadb
systemctl enable mariadb
systemctl status mariadb
Kemudian, ketikan perintah atau command di bawah ini untuk mulai inisialisasi MariaDB.
mysql_secure_installation
Enter current password for root (enter for none):
OK, successfully used password, moving on…
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
… Success!
Remove anonymous users? [Y/n] y
… Success!
Disallow root login remotely? [Y/n] y
… Success!
Remove test database and access to it? [Y/n] y
– Dropping test database…
… Success!
– Removing privileges on test database…
… Success!
Reload privilege tables now? [Y/n] y
… Success!
Cleaning up…
All done! If you’ve completed all of the above steps, your MariaDB
installation should now be secure.
sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
Install EPEL Repository
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
Install YUM-Utils
dnf install dnf-utils http://rpms.remirepo.net/enterprise/remi-release-8.rpm
Gunakan command di bawah ini untuk melihat PHP module yang tersedia untuk diinstal.
dnf module list php
Remi’s Modular repository for Enterprise Linux 218 kB/s | 567 kB 00:02
Safe Remi’s RPM repository for Enterprise Linux 400 kB/s | 1.5 MB 00:03
Last metadata expiration check: 0:00:01 ago on Thu 21 May 2020 06:52:37 AM UTC.
CentOS-8 – AppStream
Name Stream Profiles Summary
php 7.2 [d] common [d], devel, minimal PHP scripting language
php 7.3 common, devel, minimal PHP scripting language
Remi’s Modular repository for Enterprise Linux 8 – x86_64
Name Stream Profiles Summary
php remi-7.2 common [d], devel, minimal PHP scripting language
php remi-7.3 common [d], devel, minimal PHP scripting language
php remi-7.4 common [d], devel, minimal PHP scripting language
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
Dari output di atas, PHP versi 7.4 adalah versi terbaru yang akan digunakan sebagai bagian
rangkaian cara instalasi LAMP Stack berikut, tapi kamu perlu melakukan reset PHP module
terlebih dulu dengan memasukkan command di bawah ini.
dnf module reset php
Kemudian enable module php versi 7.4 yang terbaru atau up-to-date.
$ dnf module enable php:remi-7.4
Dependencies resolved.
dnf install php php-opcache php-gd php-curl php-mysqlnd
php -v
systemctl enable php-fpm
systemctl start php-fpm
systemctl status php-fpm
Pada SELinux, untuk mengizinkan Apache untuk mengeksekusi php via php-fpm, perlu seperti di bawah ini.
setsebool -P httpd_execmem 1
systemctl restart httpd
https://www.labanapost.com/2008/11/linux/instalasi-lampp-cara-saya/
http://www.labanapost.com/2008/09/linux/bagi-bagi-partisi-di-linux/
ubuntu >>>>>>>>>>>>>>>>>>> install wp
CREATE DATABASE wordpresslamp CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
Create User Database dan Grant Permissionsnya.
GRANT ALL ON wordpresslamp.* TO 'dewauser'@'localhost' IDENTIFIED BY 'dewawebwp123';
Flush Privileges untuk reload perubahan dan keluar dari MySQL.
FLUSH PRIVILEGES;
EXIT;
cd /tmp
wget https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz
cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
cd /var/www/html/
mkdir lamp.dewiweb.net
chown -R apache:apache /var/www/html/lamp.dewiweb.net/
sudo cp -a /tmp/wordpress/. /var/www/html/lamp.dewiweb.net/
Generate secret salt secret key WordPress.
curl -s https://api.wordpress.org/secret-key/1.1/salt/
Key yang digenerate akan seperti dibawah ini.
define('AUTH_KEY','>i{2HZWW%#@[ejU_:@IQ,j*]B!~Hf`(gw7Mfk_+%@HoV8oo@=]+8X{8*dh>VTFB]');
define('SECURE_AUTH_KEY', '_uVe4X.-%c)ob^cWDxItqwa,J*,z]N4{N5!WOOMXl>JUqn|!JyOw7?&?2SQZM|3+');
define('LOGGED_IN_KEY', 'P~kb+.lQS./gA-L.E8+a>YZKN{zQ|*$8CKzwZ;bB~>gYuP5l Aa;OWrZ<N)iX<nW');
define('NONCE_KEY', '5Pl4 %AdlqowfwE;|m!z?S~ 6^8L7+vY]M=hb3a7^C>?2C`fz+u|H[F!Jf!b/uAE');
define('AUTH_SALT', 'IiI<>I<Lu)K6FaaB@OVd+a:Ao@`tbR1Hhb}a,M+4A0BG}hH$I.Qyd{x~BP4?ww( ');
define('SECURE_AUTH_SALT', 'c%G+Z|_{9i6|x4:6#up}S}SCIW;I2:c^-dtM<<DwZ`kE4)X=!XSRIid&`3cj4DCy');
define('LOGGED_IN_SALT', 'W>XGF~*uk[mA<VgO6+{FI,W,oCzp(K`r3-#3Q#0I*A1gHUoM-D|>7P4>]R+..~^K');
define('NONCE_SALT', '8NRqc!14jFBWw`:q}?NwM0h_r}@`7z^HM!A%j_VvlhcwOJ-J`#YIaBV6@9mO%| I');
/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpresslamp' );
/** MySQL database username */
define( 'DB_USER', 'dewauser' );
/** MySQL database password */
define( 'DB_PASSWORD', 'dewawebwp123' );
/** MySQL hostname */
define( 'DB_HOST', 'localhost' );
Save dan exit.
yum install git -y
cd /opt
git clone https://github.com/letsencrypt/letsencrypt
service httpd stop
./letsencrypt/letsencrypt-auto certonly --standalone
Ikuti intruksi seperti di bawah ini.
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): [email protected]
Please enter in your domain name(s) (comma and/or space separated) (Enter 'c'
to cancel): lamp.dewiweb.net
Certificate dan Chainnya disimpan pada:
/etc/letsencrypt/live/lamp.dewiweb.net/fullchain.pem
Private Key disimpan pada:
/etc/letsencrypt/live/lamp.dewiweb.net/privkey.pem
nano /etc/httpd/conf.d/example.com.conf
<VirtualHost *:80>
ServerName lamp.dewiweb.net
ServerAlias www.lamp.dewiweb.net
Redirect permanent / https://lamp.dewiweb.net/
</VirtualHost>
<VirtualHost *:443>
ServerName lamp.dewiweb.net
ServerAlias www.lamp.dewiweb.net
<If "%{HTTP_HOST} == 'www.lamp.dewiweb.net'">
Redirect permanent / https://lamp.dewiweb.net/
</If>
DirectoryIndex index.html index.php
DocumentRoot /var/www/html/lamp.dewiweb.net
ErrorLog /var/log/httpd/lamp.dewiweb.net-error.log
CustomLog /var/log/httpd/lamp.dewiweb.net-access.log combined
SSLEngine On
SSLCertificateFile /etc/letsencrypt/live/lamp.dewiweb.net/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/lamp.dewiweb.net/privkey.pem
<Directory /var/www/html/lamp.dewiweb.net>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
*save
systemctl start httpd
$ yum install php-fpm php-mysql php-mysqlnd php-pdo php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap curl curl-devel -y
systemctl restart httpd
https://www.dewaweb.com/blog/cara-install-wordpress-dengan-lamp-stack/
https://www.dewaweb.com/blog/cara-install-lamp-stack-di-centos-7/
https://betterprogramming.pub/
https://www.dewaweb.com/blog/cara-mencegah-dan-mengatasi-serangan-di-wordpress/
=================
ttps://www.hostinger.co.id/tutorial/install-lamp-ubuntu-16-04
adduser<username>
Kemudian buat sudoer untuk user yang baru saja dibuat.
usermod -aG sudo <username>
sudo su - <username>
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install apache2
http://<your_vps_ip_address_here>
http://195.110.59.211
sudo apt-get install ufw
sudo ufw allow http
sudo ufw allow https
sudo systemctl status apache2
sudo apt-get install mysql-server
sudo systemct1 status mysql
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql php-cgi php-curl php-json
sudo apt-get install nano
sudo nano /var/www/html/test.php
Pada saat instalasi berlangsung, Anda akan diminta untuk memasukkan password user root.
Pastikan untuk memasukkan password yang kut. Anda harus mengisi kolom password.
Perintah di atas mengizinkan traffic HTTP dan HTTPS melewati firewall. UFW merupakan aplikasi baris perintah
yang disebut Uncomplicated Firewall. UFW digunakan untuk mengelola dan membuat rule untuk Linux firewall.
Masukkan alamat IP VPS Anda ke browser untuk mengecek instalasi. Anda dapat mengecek status server Apache
dengan perintah di bawah ini.
Catatan: Jika Anda tidak tahu alamat IP VPS Anda, maka cara tercepat untuk mengetahuinya adalah
dengan menjalankan perintah di bawah ini. Perintah ini akan menampilkan alamat IP publik dari VPS Anda.
dig +short myip.opendns.com @resolver1.opendns.com
https://www.niagahoster.co.id/blog/cara-install-lamp-ubuntu/
Akses server menggunakan SSH dengan menggunakan user root, kemudian tambahkan user baru pada server tersebut.
$ adduser<username>
Perintah ini digunakan untuk menambahkan user baru. Agar mempunyai akses super user, maka user yang baru saja dibuat ditambahkan pada sudoers. Sudoers merupakan daftar yang digunakan untuk mencatat user apa saja yang mempunyai akses sampai ke root.
$ usermod -aG sudo <username>
Setelah proses penambahan user baru selesai maka terbentuk user baru di server, putuskan
koneksi SSH kemudian lakukan akses SSH kembali dengan user yang telah dibuat. Atau, jika
tidak ingin memutuskan koneksi dapat langsung masuk ke user baru. Caranya dengan
mengetikkan sudo su <username> pada teks perintah.
sudo apt-get update
sudo apt-get install apache2
http://<your_vps_ip_address_here>
http://10.11.12.13
sudo apt-get install ufw
sudo ufw allow http
sudo ufw allow https
sudo systemctl status apache2
sudo apt-get install mysql-server
sudo systemctl status mysql
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql php-cgi php-curl php-json
cd /var/www/html/
https://upcloud.com/community/tutorials/installing-lamp-stack-ubuntu/
sudo apt update
sudo apt upgrade
Now open ports 22 (for SSH), 80 and 443 and enable Ubuntu Firewall (ufw):
sudo ufw allow ssh
sudo ufw allow 80
sudo ufw allow 443
sudo ufw enable
sudo apt install apache2
sudo systemctl status apache2
http://YOURSERVERIPADDRESS/
sudo apt install php7.4 php7.4-mysql php-common php7.4-cli php7.4-json php7.4-common php7.4-opcache libapache2-mod-php7.4
php --version
sudo systemctl restart apache2
echo '<?php phpinfo(); ?>' | sudo tee -a /var/www/html/phpinfo.php > /dev/null
http://YOURSERVERIPADDRESS/phpinfo.php
sudo rm /var/www/html/phpinfo.php
sudo apt install mariadb-server mariadb-client
sudo systemctl status mariadb
sudo mysql_secure_installation *manual inputan .... Y
As you have no root password set for MariaDB you should simply press Enter when prompted, pressing Y on the next question to then set a root password (keep this safe and secure!) With that set, you can press Enter for the remaining questions as the defaults for each of these will help to secure your new installation.
https://betterprogramming.pub/how-to-install-lamp-stack-on-ubuntu-db77ac018116
sudo apt-get update
sudo apt-get install mysql-server mysql-client libmysqlclient-dev
sudo apt-get install apache2 apache2-doc apache2-npm-prefork apache2-utils libexpat1 ssl-cert
sudo apt-get install libapache2-mod-php7.0 php7.0 php7.0-common php7.0-curl php7.0-dev php7.0-gd php-pear php-imagick php7.0-mcrypt php7.0-mysql php7.0-ps php7.0-xsl
sudo apt-get install phpmyadmin
https://phoenixnap.com/kb/how-to-install-lamp-stack-on-ubuntu
sudo apt-get update
sudo apt-get install apache2
sudo service apache2 status
sudo ufw app list
sudo ufw app info “Apache Full”
sudo apt-get install curl
curl http://icanhazip.com
sudo apt-get install mysql-server
sudo apt-get install php libapache2-mod-php php-mysql
sudo nano /etc/apache2/mods-enabled/dir.conf *to move index html to index php
sudo systemctl restart apache2
apt-cache search php- | less
apt-cache show php-cli *For example, to find out what the module php-cli does, type:
sudo apt-get install php-cli
sudo nano /var/www/html/info.php
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-ubuntu-18-04
$ sudo a2enmod php7.2
Considering dependency mpm_prefork for php7.2:
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Module mpm_prefork already enabled
Considering conflict php5 for php7.2:
Enabling module php7.2.
To activate the new configuration, you need to run:
systemctl restart apache2
$ sudo systemctl restart apache2
https://sekolahkoding.com/forum/membuat-virtual-host-di-web-server-apache-linux-ubuntukali-linux-dll
mkdir /var/www/html/domainku.bro
cd /etc/apache2/sites-available/
sudo cp 000-default.conf domainku-bro.conf
sudo nano domainku-bro.conf
<VirtualHost *:80>
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
ubah bagian www.example.com menjadi nama domain yang ingin dibuat misal menjadi domainku.bro, jangan lupa hilangkan tanda # di belakangnya dan bagian /var/www/html menjadi lokasi yang sudah kita buat di step 1 tadi. untuk yang lainnya biarkan default saja, kurang lebih akan jadi seperti ini
<VirtualHost *:80>
ServerName domainku.bro
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/domainku.bro
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
sudo a2ensite domainku.bro
sudo nano /etc/hosts
127.0.0.1 domainku.bro
sudo service apache2 reload
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mariadb-php-lamp-stack-on-debian-10
on DEBIAN 10
sudo apt update
sudo apt install apache2
sudo ufw app list
The WWW profiles are used to manage ports used by web servers:
Output
Available applications:
. . .
WWW
WWW Cache
WWW Full
WWW Secure
sudo ufw app info "WWW Full"
Output
Profile: WWW Full
Title: Web Server (HTTP,HTTPS)
Description: Web Server (HTTP,HTTPS)
Ports:
80,443/tcp
sudo ufw allow in "WWW Full"
http://your_server_ip
sudo apt install mariadb-server
sudo mysql_secure_installation
sudo mariadb
CREATE DATABASE example_database;
GRANT ALL ON example_database.* TO 'example_user'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit
mariadb -u example_user -p
SHOW DATABASES;
sudo apt install php libapache2-mod-php php-mysql
This should install PHP without any problems. We’ll test this in a moment.
sudo nano /etc/apache2/mods-enabled/dir.conf
<IfModule mod_dir.c>
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>
Move like ...
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
sudo systemctl reload apache2
sudo systemctl status apache2
create vhost
sudo mkdir /var/www/your_domain
sudo chown -R $USER:$USER /var/www/your_domain
sudo nano /etc/apache2/sites-available/your_domain.conf
<VirtualHost *:80>
ServerName your_domain
ServerAlias www.your_domain
ServerAdmin webmaster@localhost
DocumentRoot /var/www/your_domain
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
With this VirtualHost configuration, we’re telling Apache to serve your_domain using /var/www/your_domain
as the web root directory. If you’d like to test Apache without a domain name, you can remove or comment
out the options ServerName and ServerAlias by adding a # character in the beginning of each option’s lines.
You can now use a2ensite to enable this virtual host:
sudo a2ensite your_domain
sudo a2dissite 000-default
sudo apache2ctl configtest
sudo systemctl reload apache2
nano /var/www/your_domain/info.php
http://your_domain/info.php
mariadb -u example_user -p
CREATE TABLE example_database.todo_list (
item_id INT AUTO_INCREMENT,
content VARCHAR(255),
PRIMARY KEY(item_id)
);
INSERT INTO example_database.todo_list (content) VALUES ("My first important item");
SELECT * FROM example_database.todo_list;
nano /var/www/your_domain/todo_list.php
<?php
$user = "example_user";
$password = "password";
$database = "example_database";
$table = "todo_list";
try {
$db = new PDO("mysql:host=localhost;dbname=$database", $user, $password);
echo "<h2>TODO</h2><ol>";
foreach($db->query("SELECT content FROM $table") as $row) {
echo "<li>" . $row['content'] . "</li>";
}
echo "</ol>";
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
http://your_domain/todo_list.php
----- ubuntu -----
sudo apt install apache2
sudo systemctl status apache2
sudo ufw app list
Apache
Apache Full
Apache Secure
OpenSSH
If you look into the "Apache Full" profile, you will see that it enables traffic to the ports 80 and 443:
sudo ufw app info "Apache Full"
#_Title: Web Server (HTTP,HTTPS) Description: Apache v2 is the next generation of the omnipresent Apache 80,443/tcp.
sudo ufw allow in "Apache Full"
sudo apt install mariadb-server mariadb-client
sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://sgp1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic main'
sudo apt update
sudo apt install mariadb-server
sudo systemctl status mysql
mysql_secure_installation
sudo mysql -u root
use mysql;
update user set plugin='' where User='root';
flush privileges;
\q
mysql_secure_installation
sudo apt install php libapache2-mod-php php-mysql
sudo vi /var/www/html/info.php
sudo systemctl restart apache2
sudo apt-cache search php- | less
sudo apt-cache show php-gd
sudo apt install php-gd
To install all modules (not necessary though), run:
sudo apt-get install php*
sudo hostnamectl set-hostname yourFQDNname
sudo hostnamectl
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install apache2
http://your_server_IP
sudo apt-get install php5 php5-mysql php5-mcrypt php5-gd libapache2-mod-php5
sudo apt-cache search php5
sudo apt-cache show php5-module_name
sudo apt-get install mariadb-client mariadb-server
sudo mysql_secure_installation
mysql -u root -p
sudo apt-get install phpmyadmin
sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
sudo a2enconf phpmyadmin
sudo service apache2 restart
http://your_server_IP/phpmyadmin
sudo nano /var/www/html/info.php
$ sudo apt-get install sysv-rc-conf
$ sudo sysv-rc-conf apache2 on
$ sudo sysv-rc-conf mysql on
sudo -s
apt-get -y install mysql-server mysql-client
mysql_secure_installation
apt-get -y install mariadb-server mariadb-client
mysql_secure_installation
Enter current password for root (enter for none): <-- press enter
Set root password? [Y/n] <-- y
New password: <-- Enter the new MariaDB root password here
Re-enter new password: <-- Repeat the password
Remove anonymous users? [Y/n] <-- y
Disallow root login remotely? [Y/n] <-- y
Reload privilege tables now? [Y/n] <-- y
mysql -u root -p
apt-get -y install apache2
apt-get -y install php7.2 libapache2-mod-php7.2
systemctl restart apache2
nano /var/www/html/info.php
<?php
phpinfo();
chown www-data:www-data /var/www/html/info.php
apt-cache search php7.2
apt-cache search php-
#_as not all PHP packages have the version number 7.2 in their name.
apt-get -y install php7.2-mysql php7.2-curl php7.2-gd php7.2-intl php-pear php-imagick php7.2-imap php-memcache php7.2-pspell php7.2-recode php7.2-sqlite3 php7.2-tidy php7.2-xmlrpc php7.2-xsl php7.2-mbstring php-gettext
systemctl restart apache2
#_Install the Opcache + APCu PHP cache to speed up PHP
#_PHP 7 ships with a built-in opcode cacher for caching and optimizing PHP intermediate code, it has the name 'opcache' and is available in the package php7.0-opcache. It is strongly recommended to have an Opcache installed to speed up your PHP page. Besides opcache, I will install APCu which is a compatibility wrapper for opcache to provide the functions of the APC cache, an often used caching system in PHP 5.x versions and many CMS systems still use it.
apt-get -y install php7.2-opcache php-apcu
#_Don't worry if it shows that Opcache is already installed.
systemctl restart apache2
#_Enable the SSL website in apache
#_SSL/ TLS is a security layer to encrypt the connection between the web browser and your server. Most browsers start
#_Execute the following commands on your server to enable SSL (https://) support. Run:
a2enmod ssl
a2ensite default-ssl
#_symlink in the /etc/apache2/sites-enabled folder to the file /etc/apache2/sites-available/default-ssl.conf
systemctl restart apache2
apt-get -y install python3-certbot-apache
nano /etc/apache2/sites-available/000-default.conf
ServerName example.com
certbot --apache -d example.com
cat /etc/cron.d/certbot
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
0 */12 * * * root test -x /usr/bin/certbot -a \! -d /run/systemd/system && perl -e 'sleep int(rand(43200))' && certbot -q renew
apt-get -y install phpmyadmin
Web server to configure automatically: <-- Select the option: apache2
Configure database for phpmyadmin with dbconfig-common? <-- Yes
MySQL application password for phpmyadmin: <-- Press enter, apt will create a random password automatically.
mysql -u root
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'howtoforge';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit
Afterward, you can access phpMyAdmin under http://192.168.1.100/phpmyadmin/:
Username: root
Password: howtoforge
The IP of the VM is 192.168.1.100, it can be changed in the file /etc/network/interfaces. Please change all the above passwords to secure the virtual machine.
Apache: http://httpd.apache.org/
PHP: http://www.php.net/
MySQL: http://www.mysql.com/
MariaDB: https://mariadb.com/
Ubuntu: http://www.ubuntu.com/
phpMyAdmin: http://www.phpmyadmin.net/
sudo apt update
sudo apt install apache2
#_UFW memiliki berbagai profil aplikasi berbeda yang dapat Anda manfaatkan untuk menyelesaikannya.
sudo ufw app list
#_Berikut adalah makna dari setiap profil ini:
#_Apache: Profil ini hanya membuka porta 80 (lalu lintas web normal dan tidak terenkripsi).
#_Apache Full: Profil ini membuka baik porta 80 (lalu lintas web normal & tidak terenkripsi) & port 443 (lalu lintas terenkripsi TLS/SSL).
#_Apache Secure: Profile ini hanya membuka porta 443 (lalu lintas terenkripsi TLS/SSL).
#_Untuk saat ini, sebaiknya izinkan hanya koneksi pada porta 80, karena ini adalah instalasi Apache yang baru dan Anda #_belum memiliki sertifikat TLS/SSL yang dikonfigurasi untuk mengizinkan lalu lintas HTTPS di server Anda.
sudo ufw allow in "Apache"
sudo ufw status
http://your_server_ip
#_cara untuk melakukannya dari baris perintah. Pertama, Anda dapat menggunakan alat iproute2
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'
#_alternatifnya menggunakan utilitas curl untuk menghubungi pihak luar & memberitahukan pihak luar melihat server Anda.
curl http://icanhazip.com
sudo apt install mysql-server
sudo mysql_secure_installation
#_Anda juga memerlukan libapache2-mod-php untuk memungkinkan Apache menangani berkas PHP.
#_Paket PHP inti akan secara otomatis terinstal sebagai dependensi.
sudo apt install php libapache2-mod-php php-mysql
php -v
#_Apache pada Ubuntu 20.04 memiliki satu blok server yang aktif secara asali, yang dikonfigurasi untuk menyajikan dokumen-dokumen dari direktori /var/www/html. Meskipun ini berfungsi baik untuk situs tunggal, ini bisa menjadi sulit dijalankan jika Anda menjadi hos dari beberapa situs. Alih-alih memodifikasi /var/www/html, kita akan menciptakan suatu struktur direktori dalam /var/www untuk situs your_domain, dengan membiarkan /var/www/html sebagai direktori asali yang akan ditampilkan jika permintaan klien tidak cocok dengan situs lain.
sudo mkdir /var/www/your_domain
#_Selanjutnya, tentukan kepemilikan direktori dengan variabel lingkungan $USER, yang akan merujuk pada pengguna sistem
sudo chown -R $USER:$USER /var/www/your_domain
sudo nano /etc/apache2/sites-available/your_domain.conf
/etc/apache2/sites-available/your_domain.conf
<VirtualHost *:80>
ServerName your_domain
ServerAlias www.your_domain
ServerAdmin webmaster@localhost
DocumentRoot /var/www/your_domain
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
#_Dengan konfigurasi VirtualHost ini, kita menyuruh Apache untuk menyajikan your_domain
#_menggunakan /var/www/your_domain sebagai direktori root web.
Anda dapat menggunakan a2ensite untuk mengaktifkan hos virtual yang baru:
sudo a2ensite your_domain
#_Anda mungkin ingin menonaktifkan situs web asali yang terinstal dengan Apache. Ini diperlukan jika Anda tidak menggunakan nama domain khusus, karena dalam hal ini, konfigurasi asali Apache akan menimpa hos virtual Anda. Untuk menonaktifkan situs web asali Apache, ketikkan:
sudo a2dissite 000-default
#_Untuk memastikan berkas konfigurasi Anda tidak berisi kesalahan sintaks, jalankan:
sudo apache2ctl configtest
sudo systemctl reload apache2
nano /var/www/your_domain/index.html
Sertakan konten berikut di dalam berkas ini:
<html>
<head>
<title>your_domain website</title>
</head>
<body>
<h1>Hello World!</h1>
<p>This is the landing page of <strong>your_domain</strong>.</p>
</body>
</html>
sudo nano /etc/apache2/mods-enabled/dir.conf
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
sudo systemctl reload apache2
sudo rm /var/www/your_domain/info.php
sudo mysql
CREATE DATABASE example_database;
CREATE USER 'example_user'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
GRANT ALL ON example_database.* TO 'example_user'@'%';
exit
mysql -u example_user -p
CREATE TABLE example_database.todo_list (
item_id INT AUTO_INCREMENT,
content VARCHAR(255),
PRIMARY KEY(item_id)
);
INSERT INTO example_database.todo_list (content) VALUES ("My first important item");
SELECT * FROM example_database.todo_list;
nano /var/www/your_domain/todo_list.php
<?php
$user = "example_user";
$password = "password";
$database = "example_database";
$table = "todo_list";
try {
$db = new PDO("mysql:host=localhost;dbname=$database", $user, $password);
echo "<h2>TODO</h2><ol>";
foreach($db->query("SELECT content FROM $table") as $row) {
echo "<li>" . $row['content'] . "</li>";
}
echo "</ol>";
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
http://your_domain_or_IP/todo_list.php
https://httpd.apache.org/docs/current/vhosts/
https://www.howtoforge.com/tutorial/ubuntu-lts-minimal-server/
sudo apt-get update && apt-get upgrade
sudo apt-get install nginx
sudo apt-get install ufw
Setelah itu, berikan izin pada traffic HTTP dan HTTPS agar bisa melewati firewall
sudo ufw allow http
sudo ufw allow https
ufw –help
sudo systemctl restart nginx
sudo systemctl status nginx
sudo apt install mariadb-server
sudo mysql_secure_installation
sudo mariadb
GRANT ALL ON *.* TO 'admin'@'localhost' IDENTIFIED BY 'admin1234' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit;
mariadb -u admin -p
sudo apt install php-fpm php-mysql
https://www.niagahoster.co.id/blog/cara-install-wordpress-menggunakan-nginx-di-centos-7/
https://www.niagahoster.co.id/blog/cara-install-wordpress-menggunakan-nginx-di-ubuntu/
https://langittutorial.blogspot.com/2017/12/cara-install-dan-menggunakan-respin-remastering-tool-ubuntu-16.html
https://storage.googleapis.com/kubernetes-release/release/stable.txt
https://musaamin.web.id/cara-install-dan-setting-xampp-for-linux/
https://musaamin.web.id/cara-install-nextcloud-client-ubuntu/
groupadd mysql
useradd -g mysql mysql
tar xzvf mysql-5.5.62-linux-glibc2.12-x86_64.tar.gz
mv mysql-5.5.62-linux-glibc2.12-x86_64 /usr/local/mysql
cd /usr/local/mysql
chown -R mysql:mysql *
#_Install paket dependensi libaio1.
apt install libaio1
scripts/mysql_install_db --user=mysql
cp support-files/my-medium.cnf /etc/my.cnf
#_Copy file konfigurasi service mysql-server.
bin/mysqld_safe --user=mysql &
cp support-files/mysql.server /etc/init.d/mysql.server
bin/mysqladmin -u root password 'rahasia'
ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql
reboot
update-rc.d -f mysql.server defaults
/etc/init.d/mysql.server start
/etc/init.d/mysql.server status
mysql -u root -p
https://www.youtube.com/c/musaamin/videos
sudo systemctl stop apache2
sudo systemctl disable apache2
sudo systemctl stop mysql
sudo systemctl disable mysql
Apache configuration file: /opt/lampp/etc/httpd.conf, /opt/lampp/etc/extra/httpd-xampp.conf
PHP configuration file: /opt/lampp/etc/php.ini
MySQL configuration file: /opt/lampp/etc/my.cnf
ProFTPD configuration file: /opt/lampp/etc/proftpd.conf
Direktori penting XAMPP:
Direktori Document Root: /opt/lampp/htdocs
Direktori database: /opt/lampp/var/mysql
Direktori konfigurasi: /opt/lampp/etc
cd /opt/lampp/htdocs
sudo mkdir webku.com
sudo chown $USER.$USER webku.com
sudo gedit /opt/lampp/etc/httpd.conf
# Virtual hosts
#Include etc/extra/httpd-vhosts.conf
TO.....
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
Selanjutnya buka file konfigurasi virtual hosts httpd-vhosts.conf .....
sudo gedit /opt/lampp/etc/extra/httpd-vhosts.conf
Before ...
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/opt/lampp/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error_log"
CustomLog "logs/dummy-host.example.com-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/opt/lampp/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error_log"
CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>
AFTER ...
<VirtualHost *:80>
ServerName localhost
DocumentRoot /opt/lampp/htdocs
ErrorLog "logs/localhost.error.log"
CustomLog "logs/localhost.access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerName webku.com
DocumentRoot /opt/lampp/htdocs/webku.com
ErrorLog "logs/webku.com.error.log"
CustomLog "logs/webku.com.access.log" common
</VirtualHost>
sudo gedit /etc/hosts
127.0.0.1 webku.com
sudo /opt/lampp/lampp reloadapache
https://musaamin.web.id/cara-install-dan-setting-xampp-for-linux/
sudo apt install apache2 -y
cd /etc/apache2/sites-available
sudo nano desaindah.id.conf
<VirtualHost *:80>
ServerName www.desaindah.id
ServerAlias desaindah.id
DocumentRoot /var/www/desaindah.id
<Directory /var/www/desaindah.id>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/desaindah.id.error.log
CustomLog /var/log/apache2/desaindah.id.access.log combined
</VirtualHost>
sudo a2ensite desaindah.id.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
sudo systemctl status apache2
cd /var/www
sudo mkdir desaindah.id
sudo nano desaindah.id/test.html
sudo rm /var/www/desaindah.id/test.html
sudo apt install php php-common php-mysql php-gd php-cli libapache2-mod-php -y
sudo apt install mariadb-server mariadb-client -y
sudo mysql_secure_installation
Enter current password for root (enter for none): ENTER
Set root password? [Y/n] y
New password: PASSWORD_ROOT
Re-enter new password: MASUKKAN_ULANG_PASSWORD_ROOT
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
sudo mysql -u root -p
create database opensid;
create user 'user_opensid'@'localhost' identified by 'pass_opensid';
grant all privileges on opensid.* to 'user_opensid'@'localhost';
flush privileges;
wget https://github.com/OpenSID/OpenSID/archive/v19.07.zip -O OpenSID-v19.07.zip
unzip OpenSID*.zip
sudo cp -Rv OpenSID-19.07/* /var/www/desaindah.id/
cd /var/www/desaindah.id
sudo cp -Rv desa-contoh desa
sudo chown -R $USER:www-data ../desaindah.id
sudo chmod -R 775 ../desaindah.id
mysql -u user_opensid -p opensid < desaindah.id/contoh_data_awal_20190701.sql
nano desa/config/database.php
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'user_opensid';
$db['default']['password'] = 'pass_opensid';
$db['default']['database'] = 'opensid';
Akses laman admin OpenSID http://desaindah.id/index.php/siteman, username = admin, password = sid304.
https://github.com/OpenSID/OpenSID
https://github.com/OpenSID/OpenSID/wiki
https://demo.opensid.or.id/
https://www.facebook.com/groups/opensid
https://www.howtoforge.com/tutorial/ubuntu-lts-minimal-server/
https://www.howtoforge.com/ubuntu_lamp_for_newbies
sudo apt-get install apache2
http://localhost/
sudo apt-get install php5 libapache2-mod-php5
sudo /etc/init.d/apache2 restart
sudo gedit /var/www/testphp.php
<?php phpinfo(); ?>
sudo apt-get install mysql-server
gksudo gedit /etc/mysql/my.cnf
bind-address = 127.0.0.1
mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin
gksudo gedit /etc/php5/apache2/php.ini
;extension=mysql.so
extension=mysql.so
sudo /etc/init.d/apache2 restart
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mariadb-php-lamp-stack-debian9
sudo apt update
sudo apt install apache2
sudo ufw app list
sudo ufw app info "WWW Full"
sudo ufw allow in "WWW Full"
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'
sudo apt install curl
curl http://icanhazip.com
sudo apt install mariadb-server
sudo mysql_secure_installation
sudo mariadb
GRANT ALL ON *.* TO 'admin'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit
mariadb -u admin -p
sudo apt install php libapache2-mod-php php-mysql
sudo nano /etc/apache2/mods-enabled/dir.conf
/etc/apache2/mods-enabled/dir.conf
<IfModule mod_dir.c>
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>
sudo systemctl restart apache2
apt search php- | less
apt show package_name
apt show php-cli
sudo apt install php-cli
sudo apt install package1 package2 ...
sudo nano /var/www/html/info.php
http://your_server_ip/info.php
sudo rm /var/www/html/info.php
https://medium.com/@dataq/instalasi-linux-apache-mysql-php-lamp-stack-pada-ubuntu-16-04-b243d3048b35
https://medium.com/@dataq/instalasi-php-apache-module-pada-ubuntu-16-04-481d288a909d
https://medium.com/@dataq/instalasi-apache-dan-php-fpm-pada-ubuntu-16-04-cd8900b5d529
>> Instalasi Apache
$ sudo apt update
$ sudo apt install apache2
#_alamat IP atau alamat domain server anda misalkan http://mydomain.com/ atau http://104.16.123.127/. Konfig firewall
sudo ufw app list
sudo ufw app info "Apache Full"
#_Untuk mengijinkan incoming packet dengan port dan protocol dalam application profile Apache Full, jalankan perintah:
sudo ufw allow in "Apache Full"
#_Jangan lupa untuk mengijinkan pula incoming packet dengan application profile OpenSSH dengan perintah:
sudo ufw allow in "OpenSSH"
$ sudo ufw status
$ sudo ufw enable
#_Menyembunyikan Informasi Terkait Apache
#_Menyembunyikan informasi terkait web server Apache, seperti versi Apache dan sistem operasi, sebenarnya bersifat optional karena informasi tersebut bukanlah sebuah vulnerability. Namun menyembunyikan informasi ini adalah langkah pencegahan untuk mempersulit penyerang dalam menemukan vulnerability yang ada pada aplikasi yang terpasang pada server.
#_Ada dua konfigurasi Apache yang perlu kita ubah, yaitu ServerSignature dan ServerTokens. Bukalah file /etc/apache2/conf-available/security.conf kemudian ubahlah konfigurasiServerTokensmenjadi:
#_ServerTokens Prod dan konfigurasi ServerSignature menjadi:
ServerSignature Off
#_Simpan perubahan tersebut lalu restart service Apache dengan perintah:
$sudo systemctl restart apache2.service
https://medium.com/tag/web-server
https://medium.com/tag/web-server
https://blog.panoply.io/a-comparative-vmariadb-vs-mysql
sudo apt-get update
sudo apt-get install mysql-server
mysql_secure_installation
mysql -u root -p
$ sudo apt-get update
$ sudo apt-get install mariadb-server
$ sudo mysql_secure_installation
#_Secara default user root menggunakan unix_socket untuk autentikasi, sehingga kita dapat login menggunakan user root tanpa password. Anda cukup menekan enter ketika anda diminta memasukkan current password for root.
#_https://akaabachi.medium.com/respect-of-the-kill-how-to-properly-terminate-your-linux-processes-99f6025f2e53
$ sudo mysql
Buatlah user baru disertai dengan domain. Bila user tersebut hanya boleh mengakses di komputer yang sama, maka tambahkah @localhost di belakang username, misalnya
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'difficultpassword';
Berikan hal akses administrator dengan perintah
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;
lalu flush privilege
FLUSH PRIVILEGES;
Keluarlah dari terminal MariaDB dengan perintah exit. Kemudian login kembali dengan user baru tersebut tanpa sudo
$ mysql -u admin -p
#_PHP Menggunakan Apache Module
https://medium.com/@dataq/instalasi-php-apache-module-pada-ubuntu-16-04-481d288a909d
#_Instalasi PHP Apache Module
$ sudo apt update
$ sudo apt install php libapache2-mod-php
#_Untuk mengecek apakah PHP telah berjalan di server anda, anda dapat membuat sebuah file dengan isi
<?php phpinfo(); ?>
#_Modifikasi Konfigurasi PHP
$ sudo apt install php-mysql
$ sudo systemctl restart apache2.service
<?php
$servername = "localhost";
$username = "root";
$password = "secret";
$conn = new mysqli($servername, $username, $password);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
} else {
echo("Connection success.");
}
$conn->close();
?>
#Untuk meningkatkan fungsionalitas dari PHP, anda dapat menambahkan beberapa modul tambahan ke dalam PHP. Untuk mencari modul-modul yang tersedia dalam repository, gunakanlah perintah
sudo apt-cache search php-
#_ perintah grep, misalnya anda ingin mencari modul PHP yang berkaitan dengan zip,
sudo apt-cache search php- | grep zip
#_Contoh output dari perintah tersebut adalah
libphp-pclzip - transitional dummy package
php-bz2 - bzip2 module for PHP [default]
php-pclzip - ZIP archive manager class for PHP
php-zip - Zip module for PHP [default]
php-zipstreamer - Stream zip files without i/o overhead
php7.0-bz2 - bzip2 module for PHP
php7.0-zip - Zip module for PHP
sudo apt install php-zip
sudo systemctl restart apache2.service
#_Bila anda tidak menginginkan versi PHP anda tampil pada HTTP Header, demi alasan keamanan misalnya, maka anda dapat memodifikasi file /etc/php/7.0/apache2/php.ini dan /etc/php/7.0/cli/php.ini. Pastikan variable expose_php pada kedua file tersebut bernilai Off seperti ini.
expose_php = Off
sudo systemctl restart apache2.service
#_Mengganti Default Directory Index melalui file /etc/apache2/mods-available/dir.conf.
<IfModule mod_dir.c>
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>
menjadi urutan pertama seperti ini
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
sudo systemctl restart apache2.service
https://medium.com/@dataq/instalasi-apache-dan-php-fpm-pada-ubuntu-16-04-cd8900b5d529
sudo apt update
sudo apt install php-fpm libapache2-mod-fastcgi
sudo a2enmod actions fastcgi cgid alias
#_Misalnya dalam file /etc/apache2/sites-available/000-default.conf
Alias /php7-fcgi /usr/lib/cgi-bin/php7-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php7-fcgi -socket /var/run/php/php7.0-fpm.sock -pass-header Authorization
<FilesMatch \.php$>
SetHandler application/x-httpd-php
Action application/x-httpd-php /php7-fcgi
</FilesMatch>
sudo systemctl restart apache2.service
#_ Konfigurasi VirtualHost pada Gambar 1 menggunakan socket untuk menghubungkan Apache dengan PHP-FPM yang berada dalam satu server yang sama. Bila Apache dengan PHP-FPM berada dalam server yang terpisah maka anda harus menggunakan koneksi TCP/IP, namun cara tersebut tidak dibahas dalam artikel ini.
#_Tanpa langkah berikut, sebenarnya instalasi PHP tersebut telah dapat digunakan, namun kadang kita perlu melakukan beberapa modifikasi untuk menyesuaikan dengan kebutuhan program PHP yang nantinya kita buat.
#_Modifikasi bagian cgi.fix_pathinfo sangat penting dilakukan demi alasan keamanan. Yang perlu kita lakukan adalah membuka file /etc/php/7.0/fpm/php.ini dan mengubah
;cgi.fix_pathinfo=1
menjadi
cgi.fix_pathinfo=0
#_kemudian me-restart service PHP-FPM dengan perintah
$ sudo systemctl restart php7.0-fpm.service
#_Modifikasi ini sangat penting dilakukan untuk mencegah PHP mengeksekusi file dengan nama yang paling mirip
#_Bila ingin menggunakan PHP untuk mengolah RDBMS MySQL atau MariaDB, maka anda perlu mengaktifkan PHP MySQL module
sudo apt install php-mysql
sudo systemctl restart php7.0-fpm.service
#_buatlah sebuah file di root directory server, misalnya /var/www/html/mysql.php dengan isi
<?php
$servername = "localhost";
$username = "root";
$password = "secret";
$conn = new mysqli($servername, $username, $password);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
} else {
echo("Connection success.");
}
$conn->close();
?>
#_Untuk meningkatkan fungsionalitas dari PHP, anda dapat menambahkan beberapa modul tambahan ke dalam PHP.
$ sudo apt-cache search php-
$ sudo apt-cache search php- | grep zip
libphp-pclzip - transitional dummy package
php-bz2 - bzip2 module for PHP [default]
php-pclzip - ZIP archive manager class for PHP
php-zip - Zip module for PHP [default]
php-zipstreamer - Stream zip files without i/o overhead
php7.0-bz2 - bzip2 module for PHP
php7.0-zip - Zip module for PHP
sudo apt install php-zip
sudo systemctl restart php7.0-fpm.service
#_Bila anda tidak menginginkan versi PHP anda tampil pada HTTP Header,
#_maka dapat memodifikasi file /etc/php/7.0/fpm/php.ini dan /etc/php/7.0/cli/php.ini
expose_php = Off
#_melalui file /etc/apache2/mods-available/dir.conf.
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
sudo systemctl restart apache2.service
https://medium.com/@dataq/instalasi-apache-dan-php-fpm-pada-ubuntu-16-04-cd8900b5d529
>>>>>>>>>>>>>>>
yum update && yum install httpd mariadb mariadb-server *yum os
aptitude update && aptitude install apache2 mariadb-server mariadb-client mariadb.common *debian
wget https://downloads.php.net/~ab/php-7.0.0RC1.tar.gz
tar xzf php-7.0.0RC1.tar.gz -C /opt
cd /opt/php-7.0.0RC1.tar.gz
./buildconf --force
# ./configure \
--prefix=$HOME/php7/usr \
--with-config-file-path=$HOME/php7/usr/etc \
--enable-mbstring \
--enable-zip \
--enable-bcmath \
--enable-pcntl \
--enable-ftp \
--enable-exif \
--enable-calendar \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-curl \
--with-mcrypt \
--with-iconv \
--with-gmp \
--with-pspell \
--with-gd \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--with-zlib-dir=/usr \
--with-xpm-dir=/usr \
--with-freetype-dir=/usr \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-openssl \
--with-pdo-mysql=/usr \
--with-gettext=/usr \
--with-zlib=/usr \
--with-bz2=/usr \
--with-recode=/usr \
--with-mysqli=/usr/bin/mysql_config \
--with-apxs2
#_configure: error: no acceptable C compiler found in $PATH see 'config.log' for more details
yum install gcc
aptitude install gcc
#_configure: error: xml2-config not found. Please check your libxml2 installation.
gcc
libxml2-devel
pkgconfig
openssl-devel
bzip2-devel
curl-devel
libpng-devel
libpng-devel
libjpeg-devel
libXpm-devel
freetype-devel
gmp-devel
libmcrypt-devel
mariadb-devel
aspell-devel
recode-devel
httpd-devel
yum install gcc libxml2-devel pkgconfig openssl-devel bzip2-devel libpng-devel libpng-devel libjpeg-devel libXpm-devel freetype-devel gmp-devel libmcrypt-devel mariadb-devel aspell-devel recode-devel httpd-devel
make
make install
#_debian
apt-get install make libxml2-dev libcurl4-openssl-dev libjpeg-dev libpng-dev libxpm-dev libmysqlclient-dev libicu-dev libfreetype6-dev libxslt-dev libssl-dev libbz2-dev libgmp-dev libmcrypt-dev libpspell-dev librecode-dev apache2-dev
ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h
make
make install
ls -l /opt/php-7.0.0RC1 | grep php.ini
cp /opt/php-7.0.0RC1/php.ini-development /usr/local/lib
/etc/httpd/conf/httpd.conf *yum
/etc/apache2/apache2.conf *deb
LoadModule php7_module /usr/lib64/httpd/modules/libphp7.so
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
#_ debi omit the LoadModule line & also need to remove & create the follow symbolic links to the indicated Apache modules
cd /etc/apache2
rm mods-enabled/mpm_event.conf
rm mods-enabled/mpm_event.load
ln -s mods-available/mpm_prefork.conf mpm_prefork.conf
ln -s mods-available/mpm_prefork.load mpm_prefork.load
# systemctl restart httpd [On CentOS 7 box]
# systemctl restart apache2 [On Debian 8 box]
---------------------
#yum -y update
#yum install net-snmp net-snmp-utils -y
#systemctl enable snmpd
#systemctl restart snmpd
#sudo yum install firewalld
#sudo systemctl enable firewalld
#mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.orig
#systemctl restart firewalld
#firewall-cmd --permanent --add-port=161/udp
#firewall-cmd --reload
#firewall-cmd --list-all
######echo -e "# sec.name source community\ncom2sec notConfigUser default @lawangs18\n
####\n# Second, map the security name into a group name:\n
# We do not want annoying "Connection from UDP: " messages in syslog.\n# If the following option is commented out, snmpd will print each incoming\n
# connection, which can be useful for debugging.\ndontLogTCPWrappersConnects yes" > /etc/snmp/snmpd.conf
https://docs.joomla.org/Configuring_a_LAMPP_server_for_PHP_development/Linux_desktop
sudo apt-get install apache2 php5-mysql libapache2-mod-php5 mysql-server phpmyadmin php5-curl
cek localhost after install
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/test.php
Apache Default Web Site Folder
Location: "/var/www/"
Apache Web Sites Configuration Files
Location: /etc/apache2/sites-available/
Apache Configuration Files
Location: "/etc/apache2/apache2.conf" Location: "/etc/apache2/envvars"
Apache Ports Configuration File
Location: "/etc/apache2/ports.conf"
Apache Log Files
Location: "/var/log/apache2/"
Configuration
Enabling mod_rewrite
The mod_rewrite module uses a rule-based rewriting engine based on a PCRE regular-expression parser to rewrite requested URLs on the fly. By default, mod_rewrite maps a URL to a filesystem path. However, it can also be used to redirect one URL to another URL, or to invoke an internal proxy fetch.
For more information, visit http://httpd.apache.org/docs/current/mod/mod_rewrite.html
sudo a2enmod rewrite
sudo service apache2 restart
Deploying a New Site Folder Structure
By default the Web server is hosting the files in the location "/var/www", but for security reasons
and to avoid ownership problems, we are going to use another place to host our Website files.
Let's create a new folder to store the Web files and the log files of the site.
mkdir /home/youruser/lamp/
mkdir /home/youruser/lamp/public_html/
mkdir /home/youruser/lamp/logs/
NOTE: You can place your new site folders at any location; this is just an example. Replace "youruser" with an actual Linux username.
To store the Website files we are going to use the folder "public_html". For our log files, we are going to use the folder "logs".
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/mydevsite.conf
NOTE: "mydevsite" is the name of the new site used in this example. You can use any other name you like.
sudo gedit /etc/apache2/sites-available/mydevsite.conf
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
echo "--> CentOS System, Pasang Apache, PHP, MariaDB <--"
echo "Nama Pelanggan : ";
read a;
echo "Selamat Datang Mr./Mrs. $a, Lanjut?";
sudo yum -y update
sudo reboot
#https://www.youtube.com/watch?v=YGNeZV1raGQ&feature=emb_title
#_On Fedora, standards repositories are enough, on Enterprise Linux (RHEL, CentOS) the Extra Packages for Enterprise #_Linux (EPEL) repository must be configured, and on RHEL the optional channel must be enabled.
yum update && yum install epel-release
#_CentOS version 7.7
yum update && yum install epel-release
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget https://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-12.noarch.rpm
rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm #[On CentOS/RHEL 7]
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm
#_centos6
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
#_CentOS version 8.0
dnf install http://rpms.remirepo.net/fedora/remi-release-29.rpm #[On Fedora 29]
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
#_Fedora 31
dnf install https://rpms.remirepo.net/fedora/remi-release-31.rpm
#_Fedora 30
dnf install https://rpms.remirepo.net/fedora/remi-release-30.rpm
#_RHEL version 8.1
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
#_RHEL version 7.7
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget https://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm
subscription-manager repos --enable=rhel-7-server-optional-rpms
#_RHEL or CentOS 7
yum install yum-utils
#shows all enabled repositories. These two commands are identical.
yum repolist
yum -v repolist all
yum repolist disabled
#_For example, to install PHP 7.x version, use the following command.
#_---------CentOS & RHEL -------------
yum-config-manager --disable remi-php54
yum-config-manager --enable remi-php70 && yum install php
yum-config-manager --enable remi-php71 && yum install php
yum-config-manager --enable remi-php72 && yum install php
yum-config-manager --enable remi-php73 && yum install php
yum-config-manager --enable remi-php74 # <---
#_------------- On Fedora -------------
dnf --enablerepo=remi install php70
dnf --enablerepo=remi install php73 #[Install PHP 7.3]
#_------ RHEL/CentOS 7/6------
yum search all php
#_------ Fedora / CENTOS 8------
dnf search all php
yum install httpd mariadb mariadb-server php php-common php-mysql php-gd php-xml php-mbstring php-mcrypt
systemctl start mariadb
mysql_secure_installation
systemctl enable mariadb
#yum --enablerepo=epel,remi install httpd
systemctl enable httpd.service
systemctl start httpd.service
systemctl start httpd
systemctl enable httpd
#__Then we will configure MariaDB to start automatically on system boot:
systemctl enable mariadb
#_rhel6
subscription-manager repos --enable=rhel-6-server-optional-rpms
#_rhel7
subscription-manager repos --enable=rhel-7-server-optional-rpms
#_Fedora 24-29
# rpm -Uvh http://rpms.remirepo.net/fedora/remi-release-29.rpm [On Fedora 29]
# rpm -Uvh http://rpms.remirepo.net/fedora/remi-release-28.rpm [On Fedora 28] dst
#_Fedora
dnf config-manager --set-enabled remi-php74
#CentOS 8,
php module usage
#_With Fedora modular and RHEL / CentOS 8, you can simply use the remi-7.4 stream of the php module
dnf module reset php
dnf module install php:remi-7.4
remi-php74 repository activation
#_PHP upgrade By choice, the packages have the same name than in the distribution, so a simple update is enough:
yum update
rpm -Uvh https://repo.mysql.com/mysql80-community-release-el7-1.noarch.rpm
#_default MySQL 8 repository is enabled for installation. To change edit repository
#_configuration file (/etc/yum.repos.d/mysql-community.repo) and enable/disable repositories as per requirements.
yum install mysql-server
systemctl enable mysqld.service
systemctl start mysqld.service
#_The installer generated a temporary password for MySQL root user and copied to log file. You can find this password
grep "A temporary password" /var/log/mysqld.log | tail -n1
#_[Some text hidden] A temporary password is generated for root@localhost: Eif;=YpBy2h#
mysql_secure_installation
Enter password for user root: [Enter password here found in log file]
The existing password for the user account root has expired. Please set a new password.
New password: [Enter new password]
Re-enter new password: [Re-enter new password]
Change the password for root? - n
Remove anonymous users? - y
Disallow root login remotely? - y
Remove test database and access to it? - y
Reload privilege tables now? - y
yum --enablerepo=epel,remi-php74 install php
yum --enablerepo=remi-php74 list php-*
yum --enablerepo=remi-php74 install php-mysql php-xml php-xmlrpc php-soap php-gd
After installing php and other php modules restart Apache service.
systemctl restart httpd.service
#___Allow Port in Firewall
Finally open firewall ports for HTTP (80) and HTTPS (443) services using the following command.
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
php -v
httpd -v
mysql -v
#Install Apache, composer, laravl langsung
yum --enablerepo=remi,epel install httpd
yum --enablerepo=remi,epel install mysql-server
service mysqld start
/usr/bin/mysql_secure_installation
yum --enablerepo=remi,epel install php php-zip php-mysql php-mcrypt php-xml php-mbstring
service httpd restart
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/bin/composer
chmod +x /usr/bin/composer
cd /var/www
git clone https://github.com/laravel/laravel.git
cd /var/www/laravel
composer install
chown -R apache.apache /var/www/laravel
chmod -R 755 /var/www/laravel
chmod -R 755 /var/www/laravel/storage
#_SELinux enabled systems also run the below command to allow write on storage directory.
chcon -R -t httpd_sys_rw_content_t /var/www/laravel/storage
cp .env.example .env
php artisan key:generate
Apache configuration file /etc/httpd/conf/httpd.conf
vim /etc/httpd/conf/httpd.conf
<VirtualHost *:80>
ServerName laravel.example.com
DocumentRoot /var/www/laravel/public
<Directory /var/www/laravel>
AllowOverride All
</Directory>
</VirtualHost>
#_centos_8
dnf install httpd -y
systemctl enable --now httpd
systemctl status httpd
firewall-cmd --add-service=http --permanent
firewall-cmd --reload
firewall-cmd --list-services
dnf info php
dnf install php
systemctl enable php-fpm
systemctl start php-fpm
systemctl status php-fpm
dnf search php-
php-gd.x86_64 : A module for PHP applications for using the gd graphics library
php-cli.x86_64 : Command-line interface for PHP
php-fpm.x86_64 : PHP FastCGI Process Manager
php-cli.x86_64 : Command-line interface for PHP
cd /var/www/html/
echo "<h1>hello world</h1>" > index.html
cd /var/www
mkdir superuser.web.id wpdev.web.id
echo "<h1>superuser.web.id</h1>" > superuser.web.id/index.html
echo "<h1>wpdev.web.id</h1>" > wpdev.web.id/index.html
cd /etc/httpd/conf.d/
vi superuser.web.id.conf
<VirtualHost *:80>
ServerName www.superuser.web.id
ServerAlias superuser.web.id
DocumentRoot /var/www/superuser.web.id
<Directory /var/www/superuser.web.id>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/httpd/superuser.web.id_error.log
CustomLog /var/log/httpd/superuser.web.id_access.log combined
</VirtualHost>
vi wpdev.web.id.conf
<VirtualHost *:80>
ServerName www.wpdev.web.id
ServerAlias wpdev.web.id
DocumentRoot /var/www/wpdev.web.id
<Directory /var/www/wpdev.web.id>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/httpd/wpdev.web.id_error.log
CustomLog /var/log/httpd/wpdev.web.id_access.log combined
</VirtualHost>
systemctl restart httpd
systemctl status httpd
# mysql -u root -p
Enter password:
## Create database ##
CREATE DATABASE wordpress;
## Creating new user ##
CREATE USER wordpress@localhost IDENTIFIED BY "secure_password";
## Grant privileges to database ##
GRANT ALL ON wordpress.* TO wordpress@localhost;
## FLUSH privileges ##
FLUSH PRIVILEGES;
## Exit ##
exit
cd /tmp && wget http://wordpress.org/latest.tar.gz
tar -xvzf latest.tar.gz -C /var/www/html
/var/www/html/wordpress
chown -R apache /var/www/html/wordpress
#Creating Apache Virtual Host for WordPress
vim /etc/httpd/conf/httpd.conf
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/wordpress
ServerName tecminttest.com
ServerAlias www.tecminttest.com
ErrorLog /var/log/httpd/tecminttest-error-log
CustomLog /var/log/httpd/tecminttest-acces-log common
</VirtualHost>
systemctl restart httpd
#_on ubuntu add vhost domain demo like www.wordpress.lan
$ sudo nano /etc/hosts
$ ping wordpress.lan
#_in windows C:\Windows\System32\drivers\etc
sudo apt-get install apache2 apache2-utils php libapache2-mod-php php-mysql php-curl php-gd php-intl php-mbstring php-soap php-xml php-xmlrpc php-zip mariadb-server mariadb-client
sudo apt-get install phpmyadmin
sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/
sudo mv /etc/apache2/conf-available/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
sudo a2enconf phpmyadmin
sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf.d/
sudo mv /etc/apache2/conf.d/apache.conf /etc/apache2/conf.d/phpmyadmin.conf
#_next step is to create a Virtual Host on the Apache web server
sudo nano /etc/apache2/sites-available/wordpress.conf
<VirtualHost *:80>
ServerName wordpress.lan
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
sudo a2ensite wordpress.conf
sudo systemctl reload apache2
#_To avoid that future Apache error concerning, ServerName FQDN missing open main configfile '/etc/apache2/apache2.conf',
ServerName wordpress.lan
sudo systemctl restart apache2
sudo mysql_secure_installation
sudo mysql -u root -p
CREATE DATABASE mysite;
GRANT ALL PRIVILEGES ON mysite.* TO 'mysiteadmin'@'localhost' IDENTIFIED BY 'SecureP@ssHere!';
FLUSH PRIVILEGES;
EXIT;
wget http://wordpress.org/latest.tar.gz
sudo tar xvzf latest.tar.gz
sudo cp -r wordpress/* /var/www/html
#_On Debian systems, run the following commands.
$ sudo tar xvzf latest.tar.gz
$ sudo mkdir -p /var/www/html
$ sudo cp -r wordpress/* /var/www/html
$ sudo service apache2 restart
$ sudo service mysql restart
$ sudo chown -R www-data /var/www/html
$ sudo chmod -R 755 /var/www/html
http://wordpress.lan/index.php
sudo chown -R root /var/www/html
#_Enable HTTPS on WordPress
$ sudo apt-get update
$ sudo apt-get install software-properties-common
$ sudo add-apt-repository universe
$ sudo apt-get update
$ sudo apt-get install certbot python3-certbot-nginx
$ sudo certbot --apache
#_you can check your site’s HTTPS at https://www.ssllabs.com/ssltest/.
yum list php
yum install httpd
systemctl enable httpd
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
#_Install repository Remi. Repository Remi ini menyediakan PHP versi 5.4, 7.0, 7.1, dan 7.2.
#_Perintah install repository di bawah ini akan menambah file .repo di /etc/yum.repos.d.
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
ls -l /etc/yum.repos.d
yum install yum-utils
yum-config-manager --enable remi-php70
yum info php
yum install php php-common
systemctl restart httpd
nano /var/www/html/info.php
#_php_di_ubuntu Install Apache and FastCGI module.
sudo apt update
sudo apt install apache2 libapache2-mod-fcgid -y
#_Install PHP and PHP-FPM.
sudo apt install php php-fpm -y
sudo systemctl status php7.4-fpm
sudo a2enmod actions fcgid alias proxy_fcgi
sudo nano /etc/apache2/sites-available/000-default.conf
<FilesMatch \.php$>
SetHandler "proxy:unix:/var/run/php/php7.4-fpm.sock|fcgi://localhost"
</FilesMatch>
sudo systemctl restart apache2
sudo systemctl status apache2
#_Access http://localhost/info.php or http://serverIP/info.php. In the Server API the value is FPM/FastCGI.
sudo echo "<?php phpinfo(); ?>" > /var/www/html/info.php
Server requirements that must be met to run Laravel 8:
PHP > 7.3_!_BCMath PHP Extension_!_Ctype PHP Extension_!_Fileinfo PHP extension_!_JSON PHP Extension
Mbstring PHP Extension_!_OpenSSL PHP Extension_!_PDO PHP Extension_!_Tokenizer_PHP_Extension_!_XML PHP Extension
sudo apt install composer
sudo apt install php php-common php-bcmath php-mbstring php-mysql php-tokenizer php-zip
#_Install Laravel 8.0 using Composer and save it in the /home/user/public_html/blog
mkdir ~/public_html
cd ~/public_html
composer create-project laravel/laravel blog 8.0
composer create-project laravel/laravel blog
cd blog
php artisan serve
#_Browse http://127.0.0.1:8000 atau http://localhost:8000.
sudo apt install apache2 libapache2-mod-php
sudo systemctl restart apache2
sudo systemctl status apache2
#_URL http://127.0.0.1:8000 can be changed to a hostname or local domain using Apache virtual host & the file /etc/hosts.
<VirtualHost *:80>
ServerName laravel.web
DocumentRoot /home/user/public_html/blog/public
<Directory /home/user/public_html/blog/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/laravel.web_error.log
CustomLog /var/log/apache2/laravel.web_access.log combined
</VirtualHost>
sudo a2ensite laravel.web.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
sudo chown -R $USER:www-data /home/user/public_html/blog
sudo chmod -R 775 /home/user/public_html/blog
sudo nano /etc/hosts
127.0.0.1 laravel.web @@
sudo apt install build-essential curl file git
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
Make homebrew available in the system environment:
test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
test -r ~/.bash_profile && echo eval" ($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile
echo "eval $($(brew --prefix)/bin/brew shellenv)" >>~/.profile
Install the dependency package for mkcert:
sudo apt install libnss3-tools
brew install mkcert
mkcert -install
#_Create an SSL certificate for laravel.web:
mkcert laravel.web
sudo mkdir /etc/apache2/ssl
sudo mv laravel.web*.pem /etc/apache2/ssl
sudo nano /etc/apache2/sites-available/laravel.web.conf
<VirtualHost *:80>
ServerName laravel.web
RewriteEngine on
RewriteCond %{SERVER_NAME} =laravel.web
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName laravel.web
DocumentRoot /home/user/public_html/blog/public
<Directory /home/user/public_html/blog/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/laravel.web_error.log
CustomLog /var/log/apache2/laravel.web_access.log combined
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/laravel.web.pem
SSLCertificateKeyFile /etc/apache2/ssl/laravel.web-key.pem
</VirtualHost>
</IfModule>
sudo a2enmod ssl
sudo systemctl restart apache2
Browse https://laravel.web.
sudo apt install mariadb-server
sudo mysql_secure_installation
Enter current password for root (enter for none): ENTER
Set root password? [Y/n] y
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
sudo mysql -u root -p
CREATE DATABASE blog;
CREATE USER 'userblog'@'localhost' IDENTIFIED BY 'passblog';
GRANT ALL PRIVILEGES ON blog.* TO 'userblog'@'localhost';
FLUSH PRIVILEGES;
EXIT;
nano ~/public_html/blog/.env
DB_DATABASE=blog
DB_USERNAME=userblog
DB_PASSWORD=passblog
php artisan migrate
Install laravel/jetstream:
composer require laravel/jetstream
composer update
Install livewire:
php artisan jetstream:install livewire
#_laravel_apache_ubuntu
sudo apt install composer
sudo apt install php php-common php-bcmath php-mbstring php-mysql php-tokenizer php-zip
mkdir ~/public_html
cd ~/public_html
composer create-project laravel/laravel blog 8.0
composer create-project laravel/laravel blog
cd blog
php artisan serve
http://127.0.0.1:8000 atau http://localhost:8000.
sudo apt install apache2 libapache2-mod-php
sudo apt install apache2 libapache2-mod-php
sudo systemctl restart apache2
sudo systemctl status apache2
hostname atau local domain dengan menggunakan Apache virtual host dan file /etc/hosts.
laravel.web:
sudo nano /etc/apache2/sites-available/laravel.web.conf
<VirtualHost *:80>
ServerName laravel.web
DocumentRoot /home/musaamin/public_html/blog/public
<Directory /home/musaamin/public_html/blog/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/laravel.web_error.log
CustomLog /var/log/apache2/laravel.web_access.log combined
</VirtualHost>
sudo a2ensite laravel.web.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
sudo chown -R $USER:www-data /home/musaamin/public_html/blog
sudo chmod -R 775 /home/musaamin/public_html/blog
sudo nano /etc/hosts
127.0.0.1 laravel.web
sudo apt install build-essential curl file git
#_Download dan jalankan installer Homebrew:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
test -r ~/.bash_profile && echo eval" ($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile
echo "eval $($(brew --prefix)/bin/brew shellenv)" >>~/.profile
brew install mkcert
#_Install Certificate Authority (CA):
mkcert -install
mkcert laravel.web
sudo mkdir /etc/apache2/ssl
sudo mv laravel.web*.pem /etc/apache2/ssl
sudo nano /etc/apache2/sites-available/laravel.web.conf
<VirtualHost *:80>
ServerName laravel.web
RewriteEngine on
RewriteCond %{SERVER_NAME} =laravel.web
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName laravel.web
DocumentRoot /home/musaamin/public_html/blog/public
<Directory /home/musaamin/public_html/blog/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/laravel.web_error.log
CustomLog /var/log/apache2/laravel.web_access.log combined
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/laravel.web.pem
SSLCertificateKeyFile /etc/apache2/ssl/laravel.web-key.pem
</VirtualHost>
</IfModule>
sudo a2enmod ssl
sudo systemctl restart apache2
sudo mysql_secure_installation
Enter current password for root (enter for none): ENTER
Set root password? [Y/n] y
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
sudo mysql -u root -p
CREATE DATABASE blog;
CREATE USER 'userblog'@'localhost' IDENTIFIED BY 'passblog';
GRANT ALL PRIVILEGES ON blog.* TO 'userblog'@'localhost';
FLUSH PRIVILEGES;
EXIT;
#_Buka file .env:
nano ~/public_html/blog/.env
Konfigurasi koneksi database:
DB_DATABASE=blog
DB_USERNAME=userblog
DB_PASSWORD=passblog
php artisan migrate
Memasang laravel/jetstream:
composer require laravel/jetstream
composer update
php artisan jetstream:install livewire
#_install_ioncube................................
yum install httpd php php-cli
systemctl enable httpd
systemctl start httpd
systemctl status httpd
curl -O https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar xzvf ioncube_loaders_lin_x86-64.tar.gz
ls ioncube
php -i | grep extension_dir
extension_dir => /usr/lib64/php/modules => /usr/lib64/php/modules
Copy ionCube Loader 5.4 ke extension directory.
cp ioncube/ioncube_loader_lin_5.4.so /usr/lib64/php/modules
#_Masukkan ionCube Loader ke dalam konfigurasi PHP.
vi /etc/php.ini
#_Masukkan opsi di bawah ini ke dalam file php.ini.
zend_extension = /usr/lib64/php/modules/ioncube_loader_lin_5.4.so
Restart Apache web server.
systemctl restart httpd
php -v
#_Here are the packages that we will install. Please keep in mind that MySQL 8 connectors (PHP, Perl, Python, Java, etc.) #_will work unchanged with MariaDB as both systems use the same client protocol & the client lib are binary compatible.
yum-config-manager --enable remi-php72 && yum install php
yum-config-manager --enable remi-php73 && yum install php
yum search php
yum install php php-mysql php-pdo php-gd php-mbstring
#echo "<?php phpinfo(); ?>" > /var/www/html/info.php
#systemctl restart httpd
#_if you get an error on PHP Date & Timezone, open php.ini config file https://www.php.net/manual/en/timezones.php
#_search and uncomment date.timezone statement, append your physical location & restart Apache daemon.
nano /etc/php.ini
date.timezone = Continent/City
#_centos7
yum --enablerepo=remi install php-mysqlnd php-pgsql php-pecl-mongo php-pdo php-pecl-memcache php-pecl-memcached php-gd php-xml php-mbstring php-mcrypt php-pecl-apcu php-cli php-pear
#_centos8
dnf --enablerepo=remi install php-mysqlnd php-pgsql php-pecl-mongo php-pdo php-pecl-memcache php-pecl-memcached php-gd php-xml php-mbstring php-mcrypt php-pecl-apcu php-cli php-pear
MariaDB/MySQL (php-mysql) – a dynamic shared object that will add MariaDB support to PHP.
PostgreSQL (php-pgsql) – PostgreSQL database support for PHP.
MongoDB (php-pecl-mongo) – An interface for communicating with the MongoDB database in PHP.
Generic (php-pdo) – A dynamic shared object that will add a database access abstraction layer to PHP.
Memcache (php-pecl-memcache) – Memcached is a caching daemon designed especially for dynamic web applications to decrease database load by storing objects in memory.
Memcached (php-pecl-memcached) An extension that uses the libmemcached lib to provide API for communicating with memcached servers.
GD (php-gd) – A dynamic share object that adds support for using the gd graphics library to PHP.
XML (php-xml) – A dynamic shared objects that adds support to PHP for manipulating XML documents.
MBString (php-mbstring) – An extension to handle multi-byte string in PHP applications.
MCrypt (php-mcrypt) – A Mcrypt library for PHP scripts.
APC (php-pecl-apcu) – APC module used to optimize and cache PHP code.
CLI (php-cli) – Command-line interface for PHP.
PEAR (php-pear) – Application Repository framework for PHP.
Install these following necessary PHP modules with the command below.
#_
rpm -Uvh https://repo.mysql.com/mysql80-community-release-el7-1.noarch.rpm [On RHEL/CentOS 7]
# rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el6-1.noarch.rpm [On RHEL/CentOS 6]
# rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-fc29-1.noarch.rpm [On Fedora 29]
# rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-fc28-1.noarch.rpm [On Fedora 28]
#_After installing the MySQL Yum repofor your Linux platform, now install the latest version (currently 8.0)
yum install mysql-community-server [On RHEL/CentOS]
# dnf install mysql-community-server [On Fedora]
service mysqld start
yum install httpd
#systemctl status|start|stop|restart|reload httpd
#service httpd status|start|stop|restart|reload
#apachectl configtest| graceful
#_Apache DocumentRoot path it’s set to /var/www/html
nano /etc/httpd/conf.d/welcome.conf
systemctl restart httpd
# systemctl start httpd
# systemctl enable httpd
# systemctl status httpd
#_Apache Virtual Hosts in RHEL/CentOS 7
cd /etc/httpd/
mkdir sites-available sites-enabled
nano conf/httpd.conf
on httpd.conf in /etc/httpd/sites-enabled
IncludeOptional sites-enabled/*.conf
nano /etc/httpd/sites-available/rheltest.lan.conf
<VirtualHost *:80>
ServerName rheltest.lan
DocumentRoot "/var/www/rheltest.lan"
<Directory "/var/www/rheltest.lan">
Options Indexes FollowSymLinks MultiViews
# AllowOverride controls what directives may be placed in .htaccess files.
AllowOverride All
# Controls who can get stuff from this server file
Order allow,deny
Allow from all
</Directory>
<IfModule mpm_peruser_module>
ServerEnvironment apache apache
</IfModule>
ErrorLog /var/log/httpd/rheltest.lan-error.log
CustomLog /var/log/httpd/rheltest.lan-access.log combined
</VirtualHost>
#_time to create a2ensite & a2dissite bash scripts on a executable system path-in this case is /usr/local/bin/ – but
#_you can use any executable path that $PATH system variable outputs. Create a2ensite Script
nano /usr/local/bin/a2ensite
#---------------------------
#!/bin/bash
if test -d /etc/httpd/sites-available && test -d /etc/httpd/sites-enabled ;
then
echo "-----------------------------------------------"
else
mkdir /etc/httpd/sites-available
mkdir /etc/httpd/sites-enabled
fi
avail=/etc/httpd/sites-available/$1.conf
enabled=/etc/httpd/sites-enabled/
site='ls /etc/httpd/sites-available/'
if [ "$#" != "1" ]; then
echo "Use script: a2ensite virtual_site"
echo -e "\nAvailable virtual hosts:\n$site"
exit 0
else
if test -e $avail; then
sudo ln -s $avail $enabled
else
echo -e "$avail virtual host does not exist! Please create one!\n$site"
exit 0
fi
if test -e $enabled/$1.conf; then
echo "Success!! Now restart Apache server: sudo systemctl restart httpd"
else
echo -e "Virtual host $avail does not exist!\nPlease see available virtual hosts:\n$site"
exit 0
fi
fi
#--------------------
#_Create a2dissite Script
nano /usr/local/bin/a2dissite
#------------------
#!/bin/bash
avail=/etc/httpd/sites-enabled/$1.conf
enabled=/etc/httpd/sites-enabled
site='ls /etc/httpd/sites-enabled/'
if [ "$#" != "1" ]; then
echo "Use script: a2dissite virtual_site"
echo -e "\nAvailable virtual hosts: \n$site"
exit 0
else
if test -e $avail; then
sudo rm $avail
else
echo -e "$avail virtual host does not exist! Exiting!"
exit 0
fi
if test -e $enabled/$1.conf; then
echo "Error!! Could not remove $avail virtual host!"
else
echo -e "Success! $avail has been removed!\nPlease restart Apache: sudo systemctl restart httpd"
exit 0
fi
fi
#-------------
chmod +x /usr/local/bin/a2*
a2ensite vhost_name
a2disite vhost_name
#_To test it, enable the virtual host created earlier, restart Apache then load http://rheltest.lan.
a2ensite rheltest.lan
systemctl restart httpd
#_That’s it! Now you can use a2eniste and a2dissite bash scripts as system commands to manage Apache Vhosts
#_Lets set up Name Based Virtual Hosting and IP based Virtual hosting in RHEL, CentOS and Fedora.
#_OS – CentOS 6.5
#_Application – Apache Web Server
#_IP Address – 192.168.0.100
#_IP Address – 192.168.0.101
#_Domain – www.example1.com
#_Domain – www.example2.com
#_before creating a virtual host, you need to create a directory
mkdir /var/www/html/example1.com/
mkdir /var/www/html/example1.com/
vi /etc/httpd/conf/httpd.conf
NameVirtualHost 192.168.0.100:80 @@
#_move to the bottom of the file by pressing Shift + G
<VirtualHost 192.168.0.100:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/example1.com
ServerName www.example1.com
ErrorLog logs/www.example1.com-error_log
CustomLog logs/www.example1.com-access_log common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/example2.com
ServerName www.example2.com
ErrorLog logs/www.example2.com-error_log
CustomLog logs/www.example2.com-access_log common
</VirtualHost>
[root@tecmint ~]# httpd -t
Syntax OK
service httpd restart
#_If syntax is OK. Please restart your Web server and add it to chkconfig
#_to make your web server start in runlevel 3 and 5 at the boot time only.
chkconfig --level 35 httpd on
[root@tecmint ~]# vi /var/www/html/example1.com/index.html
<html><head><title>www.example1.com</title></head><body><h1>Hello, Welcome to www.exa1.com.</h1></body></html>
[root@tecmint ~]# vi /var/www/html/example2.com/index.html
<html><head><title>www.example2.com</title></head><body><h1>Hello, Welcome to www.exa2.com.</h1></body></html>
http://www.example1.com
http://www.example2.com
#_To setup IP based virtual hosting, you must have more than one IP address/Port assigned to your server or your Linux
#_It can be on a single NIC card , For example: eth0:1, eth0:2, eth0:3 … so forth. Multiple NIC cards can also be #_attached. If you don’t know how to create multiple IP’s on single NIC, follow the below guide, that will help you
#_As you can see in above output, two IPs 192.168.0.100 (eth0) and 192.168.0.101 (eth0:1) is attached to the server, #_both IPs are assigned to the same physical network device (eth0). Search for word "Listen" on httpd.conf ,
[root@tecmint ~]# vi /etc/httpd/conf/httpd.conf
# Listen 80
Listen 192.168.0.100:80
#_Now, create a Virtual host sections for both the domains. Go the bottom of the file
<VirtualHost 192.168.0.100:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/example1
ServerName www.example1.com
ErrorLog logs/www.example1.com-error_log
TransferLog logs/www.example1.com-access_log
</VirtualHost>
<VirtualHost 192.168.0.101:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/example2
ServerName www.example2.com
ErrorLog logs/www.example2.com-error_log
TransferLog logs/www.example2.com-access_log
</VirtualHost>
service httpd restart
#_Installing MariaDB 10 Database Server
vi /etc/yum.repos.d/mariadb.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
#_------ On RHEL/CentOS 7 ------
yum --enablerepo=remi install httpd MariaDB-client MariaDB-server
#_------ On Fedora / CENTOS 8------
dnf --enablerepo=remi install httpd MariaDB-client MariaDB-server
systemctl enable httpd
systemctl enable mariadb
systemctl start httpd
systemctl start mariadb
#_On SysVinit
chkconfig --levels 235 httpd on
chkconfig --levels 235 mysqld on
#------ Start Apache and MySQL ------
/etc/init.d/httpd start
/etc/init.d/mysqld start
yum install mariadb-server mariadb
systemctl start mariadb
mysql_secure_installation
systemctl enable mariadb
#_by default official RHEL 7.0 or CentOS 7.0 repositories doesn’t provide PHPMYADMIN
#_install PhpMyAdmin package by enabling CentOS 7.0 rpmforge repositories using the following command.
yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm
yum install phpmyadmin
nano /etc/httpd/conf.d/phpmyadmin.conf
Order Deny,Allow @@
Deny from all @@
Allow from 127.0.0.1 @@
#_To be able to login to PhpMyAdmin Web interface using cookie authentication method
#_add a blowfish string to phpmyadmin config.inc.php file using the generate a secret string, restart Apache Web
$cfg['blowfish_secret'] = 'ftwetwe94892fwbc'; @@
#_postgres
sudo yum repolist
sudo yum search postgresql13
sudo yum -y install postgresql13 postgresql13-server
sudo /usr/pgsql-13/bin/postgresql-13-setup initdb
sudo systemctl start postgresql-13
sudo systemctl status postgresql-13
sudo systemctl enable postgresql-13
sudo su - postgres
psql -c "alter user postgres with password 'FromVarRead'" !!!!
sudo vi /var/lib/pgsql/13/data/postgresql.conf
listen_addresses = '172.20.11.11' @@@
sudo vi /var/lib/pgsql/13/data/pg_hba.conf
# Accept from anywhere (not recommended)
host all all 0.0.0.0/0 md5 @@
# Accept from trusted subnet (Recommended setting)
host all all 172.20.11.0/24 md5 @@
sudo systemctl restart postgresql-13
sql -U <dbuser> -h <serverip> -p 5432 <dbname> @@
#_postgresInCentos8
dnf module list postgresql
Output>>>
postgresql 9.6 client, server [d]
postgresql 10 [d] client, server [d]
postgresql 12 client, server
sudo dnf module enable postgresql:12
#_When prompted, press y and then ENTER to confirm that you want to enable the stream:
#_After enabling the version 12 module stream, you can install the postgresql-server package to install PostgreSQL 12
sudo dnf install postgresql-server
#_Creating a New PostgreSQL Database Cluster
#_ To create a database cluster, run the script using sudo and with the --initdb option:
sudo postgresql-setup --initdb
* Initializing database in '/var/lib/pgsql/data'
* Initialized, logs are in /var/lib/pgsql/initdb_postgresql.log
sudo systemctl start postgresql
sudo systemctl enable postgresql
#_ Created symlink /etc/systemd/system/multi-user.target.wants/postgresql.service → /usr/lib/systemd/system/postgresql.service.
sudo -i -u postgres
sudo -u postgres psql
#_If you are logged in as the postgres account, you can create a new user by typing:
createuser --interactive
#_The script will prompt you with some choices and, based on your responses, execute the necessary Postgres commands
sudo -u postgres createuser --interactive
Output >>
#_Enter name of role to add: sammy
#_Shall the new role be a superuser? (y/n) y
man createuser
createdb sammy
sudo -u postgres createdb sammy
sudo adduser sammy
#_Once this new account is available, you can either switch over and then connect to the database by first typing:
sudo -i -u sammy
psql
sudo -u sammy psql
psql -d postgres
Once logged in, you can check your current connection information by typing:
\conninfo
Output >>
#_You are connected to database "sammy" as user "sammy" via socket in "/var/run/postgresql" at port "5432".
CREATE TABLE table_name (
column_name1 col_type (field_length) column_constraints,
column_name2 col_type (field_length),
column_name3 col_type (field_length)
);
CREATE TABLE playground (
equip_id serial PRIMARY KEY,
type varchar (50) NOT NULL,
color varchar (25) NOT NULL,
location varchar(25) check (location in ('north', 'south', 'west', 'east', 'northeast', 'southeast', 'southwest', 'northwest')),
install_date date
);
\d
INSERT INTO playground (type, color, location, install_date) VALUES ('slide', 'blue', 'south', '2017-04-28');
INSERT INTO playground (type, color, location, install_date) VALUES ('swing', 'yellow', 'northwest', '2018-08-16');
SELECT * FROM playground;
DELETE FROM playground WHERE type = 'slide';
#_After creating a table, you can modify it to add or remove columns. Add a column to show the last maintenance visit
ALTER TABLE playground ADD last_maint date;
SELECT * FROM playground;
#_Deleting a column is just as simple. If you find a separate tool to keep track of maintenance history
ALTER TABLE playground DROP last_maint;
UPDATE playground SET color = 'red' WHERE type = 'swing';
https://www.tecmint.com/install-pgadmin4-in-centos-7/
yum -y install pgadmin4
mv /etc/httpd/conf.d/pgadmin4.conf.sample /etc/httpd/conf.d/pgadmin4.conf
vi /etc/httpd/conf.d/pgadmin4.conf
<VirtualHost *:80>
LoadModule wsgi_module modules/mod_wsgi.so
WSGIDaemonProcess pgadmin processes=1 threads=25
WSGIScriptAlias /pgadmin4 /usr/lib/python2.7/site-packages/pgadmin4-web/pgAdmin4.wsgi
<Directory /usr/lib/python2.7/site-packages/pgadmin4-web/>
WSGIProcessGroup pgadmin
WSGIApplicationGroup %{GLOBAL}
<IfModule mod_authz_core.c>
# Apache 2.4
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
</VirtualHost>
#_Next we will create logs and lib directories for pgAdmin4 and set their ownership:
mkdir -p /var/lib/pgadmin4/
mkdir -p /var/log/pgadmin4/
chown -R apache:apache /var/lib/pgadmin4
chown -R apache:apache /var/log/pgadmin4
vi /usr/lib/python2.7/site-packages/pgadmin4-web/config_distro.py
#_And add the following lines:
LOG_FILE = '/var/log/pgadmin4/pgadmin4.log'
SQLITE_PATH = '/var/lib/pgadmin4/pgadmin4.db'
SESSION_DB_PATH = '/var/lib/pgadmin4/sessions'
STORAGE_DIR = '/var/lib/pgadmin4/storage'
#_Finally we will create our user account, with which we will authenticate in the web interface. To do this, run:
python /usr/lib/python2.7/site-packages/pgadmin4-web/setup.py
http://ip-address/pgadmin4 or http://localhost/pgadmin
#_If you receive 403 error while accessing PgAdmin4 interface, you need to set the correct SELinux context on the
chcon -t httpd_sys_rw_content_t /var/log/pgadmin4 -R
chcon -t httpd_sys_rw_content_t /var/lib/pgadmin4 -R
#_At your first login, you will need to add a new server to manage. Click on “Add New Server”. You will need to configure #_the PostgresQL connection. In the first tab “General”, enter the following settings:
#_Name – give name of the server you are configuring.
#_Comment – leave a comment to give description of the instance.
systemctl status firewalld
firewall-cmd --state
dnf install firewalld
systemctl start firewalld
systemctl enable firewalld
systemctl status firewalld
firewall-cmd --state
firewall-cmd --get-zones
firewall-cmd --list-all-zones
firewall-cmd --get-active-zones
firewall-cmd --get-default-zone
#_Menampilkan konfigurasi satu zone, misalnya public.
firewall-cmd --zone=public --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: enp0s3 enp0s8
sources:
services: cockpit dhcpv6-client ssh
ports:
protocols:
masquerade: no
forward-ports:
#_Konfigurasi public zone di atas hanya mengijinkan service yang terdaftar yaitu cockpit, dhcpv6-client, dan ssh.
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --reload
firewall-cmd --zone=public --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: enp0s3 enp0s8
sources:
services: cockpit dhcpv6-client http ssh
firewall-cmd --get-services
#_Menghapus service dari zone gunakan remove.
firewall-cmd --zone=public --remove-service=http
#_Misalnya kita ingin mengijinkan akses ke port nomor 5000 untuk protokol TCP dan UDP.
firewall-cmd --zone=public --add-port=5000/tcp --permanent
firewall-cmd --zone=public --add-port=5000/udp --permanent
firewall-cmd --reload
firewall-cmd --zone=public --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: enp0s3 enp0s8
sources:
services: cockpit dhcpv6-client http ssh
ports: 5000/tcp 5000/udp
protocols:
masquerade: no
firewall-cmd --zone=public --list-ports
5000/tcp 5000/udp
firewall-cmd --zone=public --remove-port=5000/tcp --permanent
firewall-cmd --zone=public --remove-port=5000/udp --permanent
firewall-cmd --reload
firewall-cmd --add-service=http --permanent
firewall-cmd --reload
firewall-cmd --list-services
#_If you are running firewalld, make sure to allow Apache traffic on the firewall.
# firewall-cmd --zone=public --permanent --add-service=http
# firewall-cmd --zone=public --permanent --add-service=https
# firewall-cmd --reload
firewall-cmd --add-service=http
firewall-cmd --permanent --add-service=http
systemctl restart firewalld
# firewall-cmd --state
# firewall-cmd --list-all
# firewall-cmd --list-interfaces
# firewall-cmd --get-service
# firewall-cmd --query-service service_name
# firewall-cmd --add-port=8080/tcp
centos8
https://musaamin.web.id/cara-install-php-dengan-nginx-di-centos-8/
dnf install nginx
systemctl enable --now nginx
systemctl start nginx
systemctl status nginx
firewall-cmd --add-service=http --permanent
firewall-cmd --reload
firewall-cmd --list-services
dnf install php php-mysqlnd php-pdo php-gd php-mbstring
systemctl enable php-fpm
systemctl start php-fpm
systemctl status php-fpm
cd /usr/share/nginx/html
echo "<?php phpinfo(); ?>" > info.php #_Lalu browsing http://ip-server/info.php.
#_Buat Document Root terlebih dahulu dan file testing PHP.
mkdir /var/www/superuser.web.id
echo "<?php phpinfo(); ?>" > /var/www/superuser.web.id
vi /etc/nginx/conf.d/superuser.web.id.conf
server {
listen 80;
server_name superuser.web.id;
root /var/www/superuser.web.id;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $fastcgi_script_name =404;
include fastcgi_params;
fastcgi_pass unix:/run/php-fpm/www.sock;
fastcgi_index index.php;
fastcgi_param DOCUMENT_ROOT $realpath_root;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
}
access_log /var/log/nginx/superuser.web.id.access.log;
error_log /var/log/nginx/superuser.web.id.error.log warn;
}
systemctl restart nginx
systemctl status nginx
#_ cari nama paketnya dengan perintah dnf search.
dnf search php-
php-gd.x86_64 : A module for PHP applications for using the gd graphics library
php-cli.x86_64 : Command-line interface for PHP
php-fpm.x86_64 : PHP FastCGI Process Manager
php-cli.x86_64 : Command-line interface for PHP
systemctl enable --now nginx
systemctl start nginx
systemctl status nginx
firewall-cmd --add-service=http --permanent
firewall-cmd --reload
firewall-cmd --list-services
https://usaamin.web.id/cara-install-php-7-4-di-centos-8/
dnf install epel-release -y
dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm -y
dnf module list php
dnf module enable php:remi-7.4
dnf install php php-cli php-common
systemctl enable httpd
systemctl start httpd
systemctl status httpd
#_Cek status php-fpm service, karena CentOS 8 tidak pakai Apache module. Install PHP tadi jadi menginstall PHP-FPM.
systemctl enable php-fpm
systemctl status php-fpm
UBUNT
-----------------------------
https://saamin.web.id/how-to-install-laravel-8-on-ubuntu-2004/
Server requirements that must be met to run Laravel 8:
PHP >= 7.3
BCMath PHP Extension
Ctype PHP Extension
Fileinfo PHP extension
JSON PHP Extension
Mbstring PHP Extension
OpenSSL PHP Extension
PDO PHP Extension
Tokenizer PHP Extension
XML PHP Extension
sudo apt install composer
sudo apt install php php-common php-bcmath php-mbstring php-mysql php-tokenizer php-zip
mkdir ~/public_html
cd ~/public_html
composer create-project laravel/laravel blog 8.0
composer create-project laravel/laravel blog
cd blog
php artisan serve
#_Starting Laravel development server: http://127.0.0.1:8000
sudo apt install apache2 libapache2-mod-php
sudo systemctl restart apache2
sudo systemctl status apache2
sudo nano /etc/apache2/sites-available/laravel.web.conf
<VirtualHost *:80>
ServerName laravel.web
DocumentRoot /home/user/public_html/blog/public
<Directory /home/user/public_html/blog/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/laravel.web_error.log
CustomLog /var/log/apache2/laravel.web_access.log combined
</VirtualHost>
sudo a2ensite laravel.web.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
sudo chown -R $USER:www-data /home/user/public_html/blog
sudo chmod -R 775 /home/user/public_html/blog
sudo nano /etc/hosts
127.0.0.1 laravel.web
sudo apt install build-essential curl file git
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
Test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
test -r ~/.bash_profile && echo eval" ($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile
echo "eval $($(brew --prefix)/bin/brew shellenv)" >>~/.profile
sudo apt install libnss3-tools
brew install mkcert
mkcert -install
mkcert laravel.web
sudo mkdir /etc/apache2/ssl
sudo mv laravel.web*.pem /etc/apache2/ssl
Open the laravel.web virtual host configuration file:
sudo nano /etc/apache2/sites-available/laravel.web.conf
<VirtualHost *:80>
ServerName laravel.web
RewriteEngine on
RewriteCond %{SERVER_NAME} =laravel.web
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName laravel.web
DocumentRoot /home/user/public_html/blog/public
<Directory /home/user/public_html/blog/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/laravel.web_error.log
CustomLog /var/log/apache2/laravel.web_access.log combined
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/laravel.web.pem
SSLCertificateKeyFile /etc/apache2/ssl/laravel.web-key.pem
</VirtualHost>
</IfModule>
sudo a2enmod ssl
sudo systemctl restart apache2
sudo apt install mariadb-server
sudo mysql_secure_installation
Enter current password for root (enter for none): ENTER
Set root password? [Y/n] y
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
sudo mysql -u root -p
CREATE DATABASE blog;
CREATE USER 'userblog'@'localhost' IDENTIFIED BY 'passblog';
GRANT ALL PRIVILEGES ON blog.* TO 'userblog'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Open the .env file:
nano ~/public_html/blog/.env
DB_DATABASE=blog
DB_USERNAME=userblog
DB_PASSWORD=passblog
Run migrate to create a user table:
php artisan migrate
composer require laravel/jetstream
composer update
php artisan jetstream:install livewire
===============================================
CENTOS .......
https://www.dewaweb.com/blog/cara-install-lamp-stack-di-centos-7/
Sebelum memulainya, perlu instalasi Firewall supaya lebih secure.
Pada Firewall ini menggunakan CSF (ConfigServer Security & Firewall).
Sekilas Tentang CSF
CSF adalah Stateful Packet Ispection Firewall, Login dan Intrusion Detection & Security Application
untuk Linux Server.
cd /usr/src
wget https://download.configserver.com/csf.tgz
tar -xzf csf.tgz
cd csf
sh install.sh
nano /etc/csf/csf.conf
csf -r *RESTART ...
Berikut ini cara install LAMP Stack di CentOS 7:
Step 1 – Add Repository
Login sebagai root dan add repository EPEL dengan command di bawah ini:
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
yum install epel-release -y
yum install mariadb-server mariadb -y
systemctl start mariadb.service
systemctl enable mariadb.service
mysql_secure_installation
Enter current password for root (enter for none): <= [ENTER]
OK, successfully used password, moving on...
Set root password? [Y/n] y
New password: <= [Masukan Password root MySQL]
Re-enter new password: <= [Masukan Password root MySQL]
Password updated successfully!
Reloading privilege tables..
... Success!
Remove anonymous users? [Y/n] y
... Success!
Disallow root login remotely? [Y/n] y
... Succes!
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reload privilege tables now? [Y/n] y
... Success!
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Install web server Apache sesuai dengan LAMP Stack. Untuk saat ini Apache versi terbaru adalah 2.4.
Start dan enable Apache untuk start on-boot.
yum install httpd -y
systemctl start httpd
systemctl enable httpd
Lakukan instalasi PHP untuk memproses script website untuk ditampilkan menjadi sebuah konten.
Tambahkan Remi CentOS Repository.
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum install yum-utils -y
yum update -y
yum-config-manager --enable remi-php70
yum install php php-opcache -y
systemctl restart httpd.service ** Restart Apache untuk memperbaharui perubahan.
https://www.dewaweb.com/blog/cara-install-lamp-stack-di-centos-7/
https://www.dewaweb.com/blog/cara-instalasi-lamp-stack-di-centos-8/
Control panel tak selalu perlu digunakan untuk mengelola website pribadi di VPS atau cloud server, hal ini dapat dilakukan jika kamu sudah memiliki pengalaman pada Linux atau menjadi system administrator, karena nantinya akan penuh dengan CLI (Command Line Interface) tidak ada GUI seperti cPanel atau CWP pada umumnya. Pada artikel ini kami akan membahas mengenai cara instalasi LAMP Stack di CentOS 8.
DNF atau Dandified YUM merupakan generasi terbaru dari package manager untuk distribusi berbasis .rpm yang dirilis pada 2018. Pada command atau perintah di CentOS 8 ini, kita akan lebih banyak menggunakan DNF.
Sebelum mulai mempraktikkan cara instalasi LEMP Stack, pastikan kamu sudah memenuhi beberapa persyaratan berikut:
VPS dengan OS CentOS 8.
Domain yang sudah diarahkan ke alamat IP VPS. (Dewaweb juga menyediakan hosting murah gratis domain)
Akses root.
Update Packages CentOS 8
Kamu perlu melakukan update package pada CentOS 8 terlebih dulu menggunakan perintah DNF, kemudian reboot server.
dnf update
reboot
dnf install httpd httpd-tools -y
systemctl enable httpd
systemctl start httpd
systemctl status httpd
Setelah instalasi web server, untuk mendapatkan versi terbaru dari Apache,
kamu bisa menggunakan command di bawah ini:
rpm -qi httpd
Name : httpd
Version : 2.4.37
Release : 16.module_el8.1.0+256+ae790463
Architecture: x86_64
Install Date: Thu 21 May 2020 06:44:49 AM UTC
Group : System Environment/Daemons
Size : 5611291
License : ASL 2.0
Signature : RSA/SHA256, Mon 23 Dec 2019 10:22:02 PM UTC, Key ID 05b555b38483c65d
Source RPM : httpd-2.4.37-16.module_el8.1.0+256+ae790463.src.rpm
Build Date : Mon 23 Dec 2019 08:46:30 PM UTC
Build Host : x86-02.mbox.centos.org
Relocations : (not relocatable)
Packager : CentOS Buildsys <[email protected]>
Vendor : CentOS
URL : https://httpd.apache.org/
Summary : Apache HTTP Server
Description :
The Apache HTTP Server is a powerful, efficient, and extensible
web server.
Di sini kami menggunakan MariaDB sebagai Database di LAMP Stack ini, karena MySQL saat ini sudah deprecated alias tidak up-to-date.
dnf install mariadb-server mariadb -y
systemctl start mariadb
systemctl enable mariadb
systemctl status mariadb
Kemudian, ketikan perintah atau command di bawah ini untuk mulai inisialisasi MariaDB.
mysql_secure_installation
Enter current password for root (enter for none):
OK, successfully used password, moving on…
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
… Success!
Remove anonymous users? [Y/n] y
… Success!
Disallow root login remotely? [Y/n] y
… Success!
Remove test database and access to it? [Y/n] y
– Dropping test database…
… Success!
– Removing privileges on test database…
… Success!
Reload privilege tables now? [Y/n] y
… Success!
Cleaning up…
All done! If you’ve completed all of the above steps, your MariaDB
installation should now be secure.
sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
Install EPEL Repository
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
Install YUM-Utils
dnf install dnf-utils http://rpms.remirepo.net/enterprise/remi-release-8.rpm
Gunakan command di bawah ini untuk melihat PHP module yang tersedia untuk diinstal.
dnf module list php
Remi’s Modular repository for Enterprise Linux 218 kB/s | 567 kB 00:02
Safe Remi’s RPM repository for Enterprise Linux 400 kB/s | 1.5 MB 00:03
Last metadata expiration check: 0:00:01 ago on Thu 21 May 2020 06:52:37 AM UTC.
CentOS-8 – AppStream
Name Stream Profiles Summary
php 7.2 [d] common [d], devel, minimal PHP scripting language
php 7.3 common, devel, minimal PHP scripting language
Remi’s Modular repository for Enterprise Linux 8 – x86_64
Name Stream Profiles Summary
php remi-7.2 common [d], devel, minimal PHP scripting language
php remi-7.3 common [d], devel, minimal PHP scripting language
php remi-7.4 common [d], devel, minimal PHP scripting language
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
Dari output di atas, PHP versi 7.4 adalah versi terbaru yang akan digunakan sebagai bagian
rangkaian cara instalasi LAMP Stack berikut, tapi kamu perlu melakukan reset PHP module
terlebih dulu dengan memasukkan command di bawah ini.
dnf module reset php
Kemudian enable module php versi 7.4 yang terbaru atau up-to-date.
$ dnf module enable php:remi-7.4
Dependencies resolved.
dnf install php php-opcache php-gd php-curl php-mysqlnd
php -v
systemctl enable php-fpm
systemctl start php-fpm
systemctl status php-fpm
Pada SELinux, untuk mengizinkan Apache untuk mengeksekusi php via php-fpm, perlu seperti di bawah ini.
setsebool -P httpd_execmem 1
systemctl restart httpd
https://www.labanapost.com/2008/11/linux/instalasi-lampp-cara-saya/
http://www.labanapost.com/2008/09/linux/bagi-bagi-partisi-di-linux/
ubuntu >>>>>>>>>>>>>>>>>>> install wp
CREATE DATABASE wordpresslamp CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
Create User Database dan Grant Permissionsnya.
GRANT ALL ON wordpresslamp.* TO 'dewauser'@'localhost' IDENTIFIED BY 'dewawebwp123';
Flush Privileges untuk reload perubahan dan keluar dari MySQL.
FLUSH PRIVILEGES;
EXIT;
cd /tmp
wget https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz
cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
cd /var/www/html/
mkdir lamp.dewiweb.net
chown -R apache:apache /var/www/html/lamp.dewiweb.net/
sudo cp -a /tmp/wordpress/. /var/www/html/lamp.dewiweb.net/
Generate secret salt secret key WordPress.
curl -s https://api.wordpress.org/secret-key/1.1/salt/
Key yang digenerate akan seperti dibawah ini.
define('AUTH_KEY','>i{2HZWW%#@[ejU_:@IQ,j*]B!~Hf`(gw7Mfk_+%@HoV8oo@=]+8X{8*dh>VTFB]');
define('SECURE_AUTH_KEY', '_uVe4X.-%c)ob^cWDxItqwa,J*,z]N4{N5!WOOMXl>JUqn|!JyOw7?&?2SQZM|3+');
define('LOGGED_IN_KEY', 'P~kb+.lQS./gA-L.E8+a>YZKN{zQ|*$8CKzwZ;bB~>gYuP5l Aa;OWrZ<N)iX<nW');
define('NONCE_KEY', '5Pl4 %AdlqowfwE;|m!z?S~ 6^8L7+vY]M=hb3a7^C>?2C`fz+u|H[F!Jf!b/uAE');
define('AUTH_SALT', 'IiI<>I<Lu)K6FaaB@OVd+a:Ao@`tbR1Hhb}a,M+4A0BG}hH$I.Qyd{x~BP4?ww( ');
define('SECURE_AUTH_SALT', 'c%G+Z|_{9i6|x4:6#up}S}SCIW;I2:c^-dtM<<DwZ`kE4)X=!XSRIid&`3cj4DCy');
define('LOGGED_IN_SALT', 'W>XGF~*uk[mA<VgO6+{FI,W,oCzp(K`r3-#3Q#0I*A1gHUoM-D|>7P4>]R+..~^K');
define('NONCE_SALT', '8NRqc!14jFBWw`:q}?NwM0h_r}@`7z^HM!A%j_VvlhcwOJ-J`#YIaBV6@9mO%| I');
/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpresslamp' );
/** MySQL database username */
define( 'DB_USER', 'dewauser' );
/** MySQL database password */
define( 'DB_PASSWORD', 'dewawebwp123' );
/** MySQL hostname */
define( 'DB_HOST', 'localhost' );
Save dan exit.
yum install git -y
cd /opt
git clone https://github.com/letsencrypt/letsencrypt
service httpd stop
./letsencrypt/letsencrypt-auto certonly --standalone
Ikuti intruksi seperti di bawah ini.
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): [email protected]
Please enter in your domain name(s) (comma and/or space separated) (Enter 'c'
to cancel): lamp.dewiweb.net
Certificate dan Chainnya disimpan pada:
/etc/letsencrypt/live/lamp.dewiweb.net/fullchain.pem
Private Key disimpan pada:
/etc/letsencrypt/live/lamp.dewiweb.net/privkey.pem
nano /etc/httpd/conf.d/example.com.conf
<VirtualHost *:80>
ServerName lamp.dewiweb.net
ServerAlias www.lamp.dewiweb.net
Redirect permanent / https://lamp.dewiweb.net/
</VirtualHost>
<VirtualHost *:443>
ServerName lamp.dewiweb.net
ServerAlias www.lamp.dewiweb.net
<If "%{HTTP_HOST} == 'www.lamp.dewiweb.net'">
Redirect permanent / https://lamp.dewiweb.net/
</If>
DirectoryIndex index.html index.php
DocumentRoot /var/www/html/lamp.dewiweb.net
ErrorLog /var/log/httpd/lamp.dewiweb.net-error.log
CustomLog /var/log/httpd/lamp.dewiweb.net-access.log combined
SSLEngine On
SSLCertificateFile /etc/letsencrypt/live/lamp.dewiweb.net/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/lamp.dewiweb.net/privkey.pem
<Directory /var/www/html/lamp.dewiweb.net>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
*save
systemctl start httpd
$ yum install php-fpm php-mysql php-mysqlnd php-pdo php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap curl curl-devel -y
systemctl restart httpd
https://www.dewaweb.com/blog/cara-install-wordpress-dengan-lamp-stack/
https://www.dewaweb.com/blog/cara-install-lamp-stack-di-centos-7/
https://betterprogramming.pub/
https://www.dewaweb.com/blog/cara-mencegah-dan-mengatasi-serangan-di-wordpress/
=================
ttps://www.hostinger.co.id/tutorial/install-lamp-ubuntu-16-04
adduser<username>
Kemudian buat sudoer untuk user yang baru saja dibuat.
usermod -aG sudo <username>
sudo su - <username>
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install apache2
http://<your_vps_ip_address_here>
http://195.110.59.211
sudo apt-get install ufw
sudo ufw allow http
sudo ufw allow https
sudo systemctl status apache2
sudo apt-get install mysql-server
sudo systemct1 status mysql
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql php-cgi php-curl php-json
sudo apt-get install nano
sudo nano /var/www/html/test.php
Pada saat instalasi berlangsung, Anda akan diminta untuk memasukkan password user root.
Pastikan untuk memasukkan password yang kut. Anda harus mengisi kolom password.
Perintah di atas mengizinkan traffic HTTP dan HTTPS melewati firewall. UFW merupakan aplikasi baris perintah
yang disebut Uncomplicated Firewall. UFW digunakan untuk mengelola dan membuat rule untuk Linux firewall.
Masukkan alamat IP VPS Anda ke browser untuk mengecek instalasi. Anda dapat mengecek status server Apache
dengan perintah di bawah ini.
Catatan: Jika Anda tidak tahu alamat IP VPS Anda, maka cara tercepat untuk mengetahuinya adalah
dengan menjalankan perintah di bawah ini. Perintah ini akan menampilkan alamat IP publik dari VPS Anda.
dig +short myip.opendns.com @resolver1.opendns.com
https://www.niagahoster.co.id/blog/cara-install-lamp-ubuntu/
Akses server menggunakan SSH dengan menggunakan user root, kemudian tambahkan user baru pada server tersebut.
$ adduser<username>
Perintah ini digunakan untuk menambahkan user baru. Agar mempunyai akses super user, maka user yang baru saja dibuat ditambahkan pada sudoers. Sudoers merupakan daftar yang digunakan untuk mencatat user apa saja yang mempunyai akses sampai ke root.
$ usermod -aG sudo <username>
Setelah proses penambahan user baru selesai maka terbentuk user baru di server, putuskan
koneksi SSH kemudian lakukan akses SSH kembali dengan user yang telah dibuat. Atau, jika
tidak ingin memutuskan koneksi dapat langsung masuk ke user baru. Caranya dengan
mengetikkan sudo su <username> pada teks perintah.
sudo apt-get update
sudo apt-get install apache2
http://<your_vps_ip_address_here>
http://10.11.12.13
sudo apt-get install ufw
sudo ufw allow http
sudo ufw allow https
sudo systemctl status apache2
sudo apt-get install mysql-server
sudo systemctl status mysql
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql php-cgi php-curl php-json
cd /var/www/html/
https://upcloud.com/community/tutorials/installing-lamp-stack-ubuntu/
sudo apt update
sudo apt upgrade
Now open ports 22 (for SSH), 80 and 443 and enable Ubuntu Firewall (ufw):
sudo ufw allow ssh
sudo ufw allow 80
sudo ufw allow 443
sudo ufw enable
sudo apt install apache2
sudo systemctl status apache2
http://YOURSERVERIPADDRESS/
sudo apt install php7.4 php7.4-mysql php-common php7.4-cli php7.4-json php7.4-common php7.4-opcache libapache2-mod-php7.4
php --version
sudo systemctl restart apache2
echo '<?php phpinfo(); ?>' | sudo tee -a /var/www/html/phpinfo.php > /dev/null
http://YOURSERVERIPADDRESS/phpinfo.php
sudo rm /var/www/html/phpinfo.php
sudo apt install mariadb-server mariadb-client
sudo systemctl status mariadb
sudo mysql_secure_installation *manual inputan .... Y
As you have no root password set for MariaDB you should simply press Enter when prompted, pressing Y on the next question to then set a root password (keep this safe and secure!) With that set, you can press Enter for the remaining questions as the defaults for each of these will help to secure your new installation.
https://betterprogramming.pub/how-to-install-lamp-stack-on-ubuntu-db77ac018116
sudo apt-get update
sudo apt-get install mysql-server mysql-client libmysqlclient-dev
sudo apt-get install apache2 apache2-doc apache2-npm-prefork apache2-utils libexpat1 ssl-cert
sudo apt-get install libapache2-mod-php7.0 php7.0 php7.0-common php7.0-curl php7.0-dev php7.0-gd php-pear php-imagick php7.0-mcrypt php7.0-mysql php7.0-ps php7.0-xsl
sudo apt-get install phpmyadmin
https://phoenixnap.com/kb/how-to-install-lamp-stack-on-ubuntu
sudo apt-get update
sudo apt-get install apache2
sudo service apache2 status
sudo ufw app list
sudo ufw app info “Apache Full”
sudo apt-get install curl
curl http://icanhazip.com
sudo apt-get install mysql-server
sudo apt-get install php libapache2-mod-php php-mysql
sudo nano /etc/apache2/mods-enabled/dir.conf *to move index html to index php
sudo systemctl restart apache2
apt-cache search php- | less
apt-cache show php-cli *For example, to find out what the module php-cli does, type:
sudo apt-get install php-cli
sudo nano /var/www/html/info.php
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-ubuntu-18-04
$ sudo a2enmod php7.2
Considering dependency mpm_prefork for php7.2:
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Module mpm_prefork already enabled
Considering conflict php5 for php7.2:
Enabling module php7.2.
To activate the new configuration, you need to run:
systemctl restart apache2
$ sudo systemctl restart apache2
https://sekolahkoding.com/forum/membuat-virtual-host-di-web-server-apache-linux-ubuntukali-linux-dll
mkdir /var/www/html/domainku.bro
cd /etc/apache2/sites-available/
sudo cp 000-default.conf domainku-bro.conf
sudo nano domainku-bro.conf
<VirtualHost *:80>
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
ubah bagian www.example.com menjadi nama domain yang ingin dibuat misal menjadi domainku.bro, jangan lupa hilangkan tanda # di belakangnya dan bagian /var/www/html menjadi lokasi yang sudah kita buat di step 1 tadi. untuk yang lainnya biarkan default saja, kurang lebih akan jadi seperti ini
<VirtualHost *:80>
ServerName domainku.bro
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/domainku.bro
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
sudo a2ensite domainku.bro
sudo nano /etc/hosts
127.0.0.1 domainku.bro
sudo service apache2 reload
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mariadb-php-lamp-stack-on-debian-10
on DEBIAN 10
sudo apt update
sudo apt install apache2
sudo ufw app list
The WWW profiles are used to manage ports used by web servers:
Output
Available applications:
. . .
WWW
WWW Cache
WWW Full
WWW Secure
sudo ufw app info "WWW Full"
Output
Profile: WWW Full
Title: Web Server (HTTP,HTTPS)
Description: Web Server (HTTP,HTTPS)
Ports:
80,443/tcp
sudo ufw allow in "WWW Full"
http://your_server_ip
sudo apt install mariadb-server
sudo mysql_secure_installation
sudo mariadb
CREATE DATABASE example_database;
GRANT ALL ON example_database.* TO 'example_user'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit
mariadb -u example_user -p
SHOW DATABASES;
sudo apt install php libapache2-mod-php php-mysql
This should install PHP without any problems. We’ll test this in a moment.
sudo nano /etc/apache2/mods-enabled/dir.conf
<IfModule mod_dir.c>
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>
Move like ...
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
sudo systemctl reload apache2
sudo systemctl status apache2
create vhost
sudo mkdir /var/www/your_domain
sudo chown -R $USER:$USER /var/www/your_domain
sudo nano /etc/apache2/sites-available/your_domain.conf
<VirtualHost *:80>
ServerName your_domain
ServerAlias www.your_domain
ServerAdmin webmaster@localhost
DocumentRoot /var/www/your_domain
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
With this VirtualHost configuration, we’re telling Apache to serve your_domain using /var/www/your_domain
as the web root directory. If you’d like to test Apache without a domain name, you can remove or comment
out the options ServerName and ServerAlias by adding a # character in the beginning of each option’s lines.
You can now use a2ensite to enable this virtual host:
sudo a2ensite your_domain
sudo a2dissite 000-default
sudo apache2ctl configtest
sudo systemctl reload apache2
nano /var/www/your_domain/info.php
http://your_domain/info.php
mariadb -u example_user -p
CREATE TABLE example_database.todo_list (
item_id INT AUTO_INCREMENT,
content VARCHAR(255),
PRIMARY KEY(item_id)
);
INSERT INTO example_database.todo_list (content) VALUES ("My first important item");
SELECT * FROM example_database.todo_list;
nano /var/www/your_domain/todo_list.php
<?php
$user = "example_user";
$password = "password";
$database = "example_database";
$table = "todo_list";
try {
$db = new PDO("mysql:host=localhost;dbname=$database", $user, $password);
echo "<h2>TODO</h2><ol>";
foreach($db->query("SELECT content FROM $table") as $row) {
echo "<li>" . $row['content'] . "</li>";
}
echo "</ol>";
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
http://your_domain/todo_list.php
----- ubuntu -----
sudo apt install apache2
sudo systemctl status apache2
sudo ufw app list
Apache
Apache Full
Apache Secure
OpenSSH
If you look into the "Apache Full" profile, you will see that it enables traffic to the ports 80 and 443:
sudo ufw app info "Apache Full"
#_Title: Web Server (HTTP,HTTPS) Description: Apache v2 is the next generation of the omnipresent Apache 80,443/tcp.
sudo ufw allow in "Apache Full"
sudo apt install mariadb-server mariadb-client
sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://sgp1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic main'
sudo apt update
sudo apt install mariadb-server
sudo systemctl status mysql
mysql_secure_installation
sudo mysql -u root
use mysql;
update user set plugin='' where User='root';
flush privileges;
\q
mysql_secure_installation
sudo apt install php libapache2-mod-php php-mysql
sudo vi /var/www/html/info.php
sudo systemctl restart apache2
sudo apt-cache search php- | less
sudo apt-cache show php-gd
sudo apt install php-gd
To install all modules (not necessary though), run:
sudo apt-get install php*
sudo hostnamectl set-hostname yourFQDNname
sudo hostnamectl
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install apache2
http://your_server_IP
sudo apt-get install php5 php5-mysql php5-mcrypt php5-gd libapache2-mod-php5
sudo apt-cache search php5
sudo apt-cache show php5-module_name
sudo apt-get install mariadb-client mariadb-server
sudo mysql_secure_installation
mysql -u root -p
sudo apt-get install phpmyadmin
sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
sudo a2enconf phpmyadmin
sudo service apache2 restart
http://your_server_IP/phpmyadmin
sudo nano /var/www/html/info.php
$ sudo apt-get install sysv-rc-conf
$ sudo sysv-rc-conf apache2 on
$ sudo sysv-rc-conf mysql on
sudo -s
apt-get -y install mysql-server mysql-client
mysql_secure_installation
apt-get -y install mariadb-server mariadb-client
mysql_secure_installation
Enter current password for root (enter for none): <-- press enter
Set root password? [Y/n] <-- y
New password: <-- Enter the new MariaDB root password here
Re-enter new password: <-- Repeat the password
Remove anonymous users? [Y/n] <-- y
Disallow root login remotely? [Y/n] <-- y
Reload privilege tables now? [Y/n] <-- y
mysql -u root -p
apt-get -y install apache2
apt-get -y install php7.2 libapache2-mod-php7.2
systemctl restart apache2
nano /var/www/html/info.php
<?php
phpinfo();
chown www-data:www-data /var/www/html/info.php
apt-cache search php7.2
apt-cache search php-
#_as not all PHP packages have the version number 7.2 in their name.
apt-get -y install php7.2-mysql php7.2-curl php7.2-gd php7.2-intl php-pear php-imagick php7.2-imap php-memcache php7.2-pspell php7.2-recode php7.2-sqlite3 php7.2-tidy php7.2-xmlrpc php7.2-xsl php7.2-mbstring php-gettext
systemctl restart apache2
#_Install the Opcache + APCu PHP cache to speed up PHP
#_PHP 7 ships with a built-in opcode cacher for caching and optimizing PHP intermediate code, it has the name 'opcache' and is available in the package php7.0-opcache. It is strongly recommended to have an Opcache installed to speed up your PHP page. Besides opcache, I will install APCu which is a compatibility wrapper for opcache to provide the functions of the APC cache, an often used caching system in PHP 5.x versions and many CMS systems still use it.
apt-get -y install php7.2-opcache php-apcu
#_Don't worry if it shows that Opcache is already installed.
systemctl restart apache2
#_Enable the SSL website in apache
#_SSL/ TLS is a security layer to encrypt the connection between the web browser and your server. Most browsers start
#_Execute the following commands on your server to enable SSL (https://) support. Run:
a2enmod ssl
a2ensite default-ssl
#_symlink in the /etc/apache2/sites-enabled folder to the file /etc/apache2/sites-available/default-ssl.conf
systemctl restart apache2
apt-get -y install python3-certbot-apache
nano /etc/apache2/sites-available/000-default.conf
ServerName example.com
certbot --apache -d example.com
cat /etc/cron.d/certbot
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
0 */12 * * * root test -x /usr/bin/certbot -a \! -d /run/systemd/system && perl -e 'sleep int(rand(43200))' && certbot -q renew
apt-get -y install phpmyadmin
Web server to configure automatically: <-- Select the option: apache2
Configure database for phpmyadmin with dbconfig-common? <-- Yes
MySQL application password for phpmyadmin: <-- Press enter, apt will create a random password automatically.
mysql -u root
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'howtoforge';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit
Afterward, you can access phpMyAdmin under http://192.168.1.100/phpmyadmin/:
Username: root
Password: howtoforge
The IP of the VM is 192.168.1.100, it can be changed in the file /etc/network/interfaces. Please change all the above passwords to secure the virtual machine.
Apache: http://httpd.apache.org/
PHP: http://www.php.net/
MySQL: http://www.mysql.com/
MariaDB: https://mariadb.com/
Ubuntu: http://www.ubuntu.com/
phpMyAdmin: http://www.phpmyadmin.net/
sudo apt update
sudo apt install apache2
#_UFW memiliki berbagai profil aplikasi berbeda yang dapat Anda manfaatkan untuk menyelesaikannya.
sudo ufw app list
#_Berikut adalah makna dari setiap profil ini:
#_Apache: Profil ini hanya membuka porta 80 (lalu lintas web normal dan tidak terenkripsi).
#_Apache Full: Profil ini membuka baik porta 80 (lalu lintas web normal & tidak terenkripsi) & port 443 (lalu lintas terenkripsi TLS/SSL).
#_Apache Secure: Profile ini hanya membuka porta 443 (lalu lintas terenkripsi TLS/SSL).
#_Untuk saat ini, sebaiknya izinkan hanya koneksi pada porta 80, karena ini adalah instalasi Apache yang baru dan Anda #_belum memiliki sertifikat TLS/SSL yang dikonfigurasi untuk mengizinkan lalu lintas HTTPS di server Anda.
sudo ufw allow in "Apache"
sudo ufw status
http://your_server_ip
#_cara untuk melakukannya dari baris perintah. Pertama, Anda dapat menggunakan alat iproute2
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'
#_alternatifnya menggunakan utilitas curl untuk menghubungi pihak luar & memberitahukan pihak luar melihat server Anda.
curl http://icanhazip.com
sudo apt install mysql-server
sudo mysql_secure_installation
#_Anda juga memerlukan libapache2-mod-php untuk memungkinkan Apache menangani berkas PHP.
#_Paket PHP inti akan secara otomatis terinstal sebagai dependensi.
sudo apt install php libapache2-mod-php php-mysql
php -v
#_Apache pada Ubuntu 20.04 memiliki satu blok server yang aktif secara asali, yang dikonfigurasi untuk menyajikan dokumen-dokumen dari direktori /var/www/html. Meskipun ini berfungsi baik untuk situs tunggal, ini bisa menjadi sulit dijalankan jika Anda menjadi hos dari beberapa situs. Alih-alih memodifikasi /var/www/html, kita akan menciptakan suatu struktur direktori dalam /var/www untuk situs your_domain, dengan membiarkan /var/www/html sebagai direktori asali yang akan ditampilkan jika permintaan klien tidak cocok dengan situs lain.
sudo mkdir /var/www/your_domain
#_Selanjutnya, tentukan kepemilikan direktori dengan variabel lingkungan $USER, yang akan merujuk pada pengguna sistem
sudo chown -R $USER:$USER /var/www/your_domain
sudo nano /etc/apache2/sites-available/your_domain.conf
/etc/apache2/sites-available/your_domain.conf
<VirtualHost *:80>
ServerName your_domain
ServerAlias www.your_domain
ServerAdmin webmaster@localhost
DocumentRoot /var/www/your_domain
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
#_Dengan konfigurasi VirtualHost ini, kita menyuruh Apache untuk menyajikan your_domain
#_menggunakan /var/www/your_domain sebagai direktori root web.
Anda dapat menggunakan a2ensite untuk mengaktifkan hos virtual yang baru:
sudo a2ensite your_domain
#_Anda mungkin ingin menonaktifkan situs web asali yang terinstal dengan Apache. Ini diperlukan jika Anda tidak menggunakan nama domain khusus, karena dalam hal ini, konfigurasi asali Apache akan menimpa hos virtual Anda. Untuk menonaktifkan situs web asali Apache, ketikkan:
sudo a2dissite 000-default
#_Untuk memastikan berkas konfigurasi Anda tidak berisi kesalahan sintaks, jalankan:
sudo apache2ctl configtest
sudo systemctl reload apache2
nano /var/www/your_domain/index.html
Sertakan konten berikut di dalam berkas ini:
<html>
<head>
<title>your_domain website</title>
</head>
<body>
<h1>Hello World!</h1>
<p>This is the landing page of <strong>your_domain</strong>.</p>
</body>
</html>
sudo nano /etc/apache2/mods-enabled/dir.conf
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
sudo systemctl reload apache2
sudo rm /var/www/your_domain/info.php
sudo mysql
CREATE DATABASE example_database;
CREATE USER 'example_user'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
GRANT ALL ON example_database.* TO 'example_user'@'%';
exit
mysql -u example_user -p
CREATE TABLE example_database.todo_list (
item_id INT AUTO_INCREMENT,
content VARCHAR(255),
PRIMARY KEY(item_id)
);
INSERT INTO example_database.todo_list (content) VALUES ("My first important item");
SELECT * FROM example_database.todo_list;
nano /var/www/your_domain/todo_list.php
<?php
$user = "example_user";
$password = "password";
$database = "example_database";
$table = "todo_list";
try {
$db = new PDO("mysql:host=localhost;dbname=$database", $user, $password);
echo "<h2>TODO</h2><ol>";
foreach($db->query("SELECT content FROM $table") as $row) {
echo "<li>" . $row['content'] . "</li>";
}
echo "</ol>";
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
http://your_domain_or_IP/todo_list.php
https://httpd.apache.org/docs/current/vhosts/
https://www.howtoforge.com/tutorial/ubuntu-lts-minimal-server/
sudo apt-get update && apt-get upgrade
sudo apt-get install nginx
sudo apt-get install ufw
Setelah itu, berikan izin pada traffic HTTP dan HTTPS agar bisa melewati firewall
sudo ufw allow http
sudo ufw allow https
ufw –help
sudo systemctl restart nginx
sudo systemctl status nginx
sudo apt install mariadb-server
sudo mysql_secure_installation
sudo mariadb
GRANT ALL ON *.* TO 'admin'@'localhost' IDENTIFIED BY 'admin1234' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit;
mariadb -u admin -p
sudo apt install php-fpm php-mysql
https://www.niagahoster.co.id/blog/cara-install-wordpress-menggunakan-nginx-di-centos-7/
https://www.niagahoster.co.id/blog/cara-install-wordpress-menggunakan-nginx-di-ubuntu/
https://langittutorial.blogspot.com/2017/12/cara-install-dan-menggunakan-respin-remastering-tool-ubuntu-16.html
https://storage.googleapis.com/kubernetes-release/release/stable.txt
https://musaamin.web.id/cara-install-dan-setting-xampp-for-linux/
https://musaamin.web.id/cara-install-nextcloud-client-ubuntu/
groupadd mysql
useradd -g mysql mysql
tar xzvf mysql-5.5.62-linux-glibc2.12-x86_64.tar.gz
mv mysql-5.5.62-linux-glibc2.12-x86_64 /usr/local/mysql
cd /usr/local/mysql
chown -R mysql:mysql *
#_Install paket dependensi libaio1.
apt install libaio1
scripts/mysql_install_db --user=mysql
cp support-files/my-medium.cnf /etc/my.cnf
#_Copy file konfigurasi service mysql-server.
bin/mysqld_safe --user=mysql &
cp support-files/mysql.server /etc/init.d/mysql.server
bin/mysqladmin -u root password 'rahasia'
ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql
reboot
update-rc.d -f mysql.server defaults
/etc/init.d/mysql.server start
/etc/init.d/mysql.server status
mysql -u root -p
https://www.youtube.com/c/musaamin/videos
sudo systemctl stop apache2
sudo systemctl disable apache2
sudo systemctl stop mysql
sudo systemctl disable mysql
Apache configuration file: /opt/lampp/etc/httpd.conf, /opt/lampp/etc/extra/httpd-xampp.conf
PHP configuration file: /opt/lampp/etc/php.ini
MySQL configuration file: /opt/lampp/etc/my.cnf
ProFTPD configuration file: /opt/lampp/etc/proftpd.conf
Direktori penting XAMPP:
Direktori Document Root: /opt/lampp/htdocs
Direktori database: /opt/lampp/var/mysql
Direktori konfigurasi: /opt/lampp/etc
cd /opt/lampp/htdocs
sudo mkdir webku.com
sudo chown $USER.$USER webku.com
sudo gedit /opt/lampp/etc/httpd.conf
# Virtual hosts
#Include etc/extra/httpd-vhosts.conf
TO.....
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
Selanjutnya buka file konfigurasi virtual hosts httpd-vhosts.conf .....
sudo gedit /opt/lampp/etc/extra/httpd-vhosts.conf
Before ...
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/opt/lampp/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error_log"
CustomLog "logs/dummy-host.example.com-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/opt/lampp/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error_log"
CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>
AFTER ...
<VirtualHost *:80>
ServerName localhost
DocumentRoot /opt/lampp/htdocs
ErrorLog "logs/localhost.error.log"
CustomLog "logs/localhost.access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerName webku.com
DocumentRoot /opt/lampp/htdocs/webku.com
ErrorLog "logs/webku.com.error.log"
CustomLog "logs/webku.com.access.log" common
</VirtualHost>
sudo gedit /etc/hosts
127.0.0.1 webku.com
sudo /opt/lampp/lampp reloadapache
https://musaamin.web.id/cara-install-dan-setting-xampp-for-linux/
sudo apt install apache2 -y
cd /etc/apache2/sites-available
sudo nano desaindah.id.conf
<VirtualHost *:80>
ServerName www.desaindah.id
ServerAlias desaindah.id
DocumentRoot /var/www/desaindah.id
<Directory /var/www/desaindah.id>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/desaindah.id.error.log
CustomLog /var/log/apache2/desaindah.id.access.log combined
</VirtualHost>
sudo a2ensite desaindah.id.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
sudo systemctl status apache2
cd /var/www
sudo mkdir desaindah.id
sudo nano desaindah.id/test.html
sudo rm /var/www/desaindah.id/test.html
sudo apt install php php-common php-mysql php-gd php-cli libapache2-mod-php -y
sudo apt install mariadb-server mariadb-client -y
sudo mysql_secure_installation
Enter current password for root (enter for none): ENTER
Set root password? [Y/n] y
New password: PASSWORD_ROOT
Re-enter new password: MASUKKAN_ULANG_PASSWORD_ROOT
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
sudo mysql -u root -p
create database opensid;
create user 'user_opensid'@'localhost' identified by 'pass_opensid';
grant all privileges on opensid.* to 'user_opensid'@'localhost';
flush privileges;
wget https://github.com/OpenSID/OpenSID/archive/v19.07.zip -O OpenSID-v19.07.zip
unzip OpenSID*.zip
sudo cp -Rv OpenSID-19.07/* /var/www/desaindah.id/
cd /var/www/desaindah.id
sudo cp -Rv desa-contoh desa
sudo chown -R $USER:www-data ../desaindah.id
sudo chmod -R 775 ../desaindah.id
mysql -u user_opensid -p opensid < desaindah.id/contoh_data_awal_20190701.sql
nano desa/config/database.php
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'user_opensid';
$db['default']['password'] = 'pass_opensid';
$db['default']['database'] = 'opensid';
Akses laman admin OpenSID http://desaindah.id/index.php/siteman, username = admin, password = sid304.
https://github.com/OpenSID/OpenSID
https://github.com/OpenSID/OpenSID/wiki
https://demo.opensid.or.id/
https://www.facebook.com/groups/opensid
https://www.howtoforge.com/tutorial/ubuntu-lts-minimal-server/
https://www.howtoforge.com/ubuntu_lamp_for_newbies
sudo apt-get install apache2
http://localhost/
sudo apt-get install php5 libapache2-mod-php5
sudo /etc/init.d/apache2 restart
sudo gedit /var/www/testphp.php
<?php phpinfo(); ?>
sudo apt-get install mysql-server
gksudo gedit /etc/mysql/my.cnf
bind-address = 127.0.0.1
mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin
gksudo gedit /etc/php5/apache2/php.ini
;extension=mysql.so
extension=mysql.so
sudo /etc/init.d/apache2 restart
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mariadb-php-lamp-stack-debian9
sudo apt update
sudo apt install apache2
sudo ufw app list
sudo ufw app info "WWW Full"
sudo ufw allow in "WWW Full"
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'
sudo apt install curl
curl http://icanhazip.com
sudo apt install mariadb-server
sudo mysql_secure_installation
sudo mariadb
GRANT ALL ON *.* TO 'admin'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit
mariadb -u admin -p
sudo apt install php libapache2-mod-php php-mysql
sudo nano /etc/apache2/mods-enabled/dir.conf
/etc/apache2/mods-enabled/dir.conf
<IfModule mod_dir.c>
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>
sudo systemctl restart apache2
apt search php- | less
apt show package_name
apt show php-cli
sudo apt install php-cli
sudo apt install package1 package2 ...
sudo nano /var/www/html/info.php
http://your_server_ip/info.php
sudo rm /var/www/html/info.php
https://medium.com/@dataq/instalasi-linux-apache-mysql-php-lamp-stack-pada-ubuntu-16-04-b243d3048b35
https://medium.com/@dataq/instalasi-php-apache-module-pada-ubuntu-16-04-481d288a909d
https://medium.com/@dataq/instalasi-apache-dan-php-fpm-pada-ubuntu-16-04-cd8900b5d529
>> Instalasi Apache
$ sudo apt update
$ sudo apt install apache2
#_alamat IP atau alamat domain server anda misalkan http://mydomain.com/ atau http://104.16.123.127/. Konfig firewall
sudo ufw app list
sudo ufw app info "Apache Full"
#_Untuk mengijinkan incoming packet dengan port dan protocol dalam application profile Apache Full, jalankan perintah:
sudo ufw allow in "Apache Full"
#_Jangan lupa untuk mengijinkan pula incoming packet dengan application profile OpenSSH dengan perintah:
sudo ufw allow in "OpenSSH"
$ sudo ufw status
$ sudo ufw enable
#_Menyembunyikan Informasi Terkait Apache
#_Menyembunyikan informasi terkait web server Apache, seperti versi Apache dan sistem operasi, sebenarnya bersifat optional karena informasi tersebut bukanlah sebuah vulnerability. Namun menyembunyikan informasi ini adalah langkah pencegahan untuk mempersulit penyerang dalam menemukan vulnerability yang ada pada aplikasi yang terpasang pada server.
#_Ada dua konfigurasi Apache yang perlu kita ubah, yaitu ServerSignature dan ServerTokens. Bukalah file /etc/apache2/conf-available/security.conf kemudian ubahlah konfigurasiServerTokensmenjadi:
#_ServerTokens Prod dan konfigurasi ServerSignature menjadi:
ServerSignature Off
#_Simpan perubahan tersebut lalu restart service Apache dengan perintah:
$sudo systemctl restart apache2.service
https://medium.com/tag/web-server
https://medium.com/tag/web-server
https://blog.panoply.io/a-comparative-vmariadb-vs-mysql
sudo apt-get update
sudo apt-get install mysql-server
mysql_secure_installation
mysql -u root -p
$ sudo apt-get update
$ sudo apt-get install mariadb-server
$ sudo mysql_secure_installation
#_Secara default user root menggunakan unix_socket untuk autentikasi, sehingga kita dapat login menggunakan user root tanpa password. Anda cukup menekan enter ketika anda diminta memasukkan current password for root.
#_https://akaabachi.medium.com/respect-of-the-kill-how-to-properly-terminate-your-linux-processes-99f6025f2e53
$ sudo mysql
Buatlah user baru disertai dengan domain. Bila user tersebut hanya boleh mengakses di komputer yang sama, maka tambahkah @localhost di belakang username, misalnya
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'difficultpassword';
Berikan hal akses administrator dengan perintah
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;
lalu flush privilege
FLUSH PRIVILEGES;
Keluarlah dari terminal MariaDB dengan perintah exit. Kemudian login kembali dengan user baru tersebut tanpa sudo
$ mysql -u admin -p
#_PHP Menggunakan Apache Module
https://medium.com/@dataq/instalasi-php-apache-module-pada-ubuntu-16-04-481d288a909d
#_Instalasi PHP Apache Module
$ sudo apt update
$ sudo apt install php libapache2-mod-php
#_Untuk mengecek apakah PHP telah berjalan di server anda, anda dapat membuat sebuah file dengan isi
<?php phpinfo(); ?>
#_Modifikasi Konfigurasi PHP
$ sudo apt install php-mysql
$ sudo systemctl restart apache2.service
<?php
$servername = "localhost";
$username = "root";
$password = "secret";
$conn = new mysqli($servername, $username, $password);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
} else {
echo("Connection success.");
}
$conn->close();
?>
#Untuk meningkatkan fungsionalitas dari PHP, anda dapat menambahkan beberapa modul tambahan ke dalam PHP. Untuk mencari modul-modul yang tersedia dalam repository, gunakanlah perintah
sudo apt-cache search php-
#_ perintah grep, misalnya anda ingin mencari modul PHP yang berkaitan dengan zip,
sudo apt-cache search php- | grep zip
#_Contoh output dari perintah tersebut adalah
libphp-pclzip - transitional dummy package
php-bz2 - bzip2 module for PHP [default]
php-pclzip - ZIP archive manager class for PHP
php-zip - Zip module for PHP [default]
php-zipstreamer - Stream zip files without i/o overhead
php7.0-bz2 - bzip2 module for PHP
php7.0-zip - Zip module for PHP
sudo apt install php-zip
sudo systemctl restart apache2.service
#_Bila anda tidak menginginkan versi PHP anda tampil pada HTTP Header, demi alasan keamanan misalnya, maka anda dapat memodifikasi file /etc/php/7.0/apache2/php.ini dan /etc/php/7.0/cli/php.ini. Pastikan variable expose_php pada kedua file tersebut bernilai Off seperti ini.
expose_php = Off
sudo systemctl restart apache2.service
#_Mengganti Default Directory Index melalui file /etc/apache2/mods-available/dir.conf.
<IfModule mod_dir.c>
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>
menjadi urutan pertama seperti ini
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
sudo systemctl restart apache2.service
https://medium.com/@dataq/instalasi-apache-dan-php-fpm-pada-ubuntu-16-04-cd8900b5d529
sudo apt update
sudo apt install php-fpm libapache2-mod-fastcgi
sudo a2enmod actions fastcgi cgid alias
#_Misalnya dalam file /etc/apache2/sites-available/000-default.conf
Alias /php7-fcgi /usr/lib/cgi-bin/php7-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php7-fcgi -socket /var/run/php/php7.0-fpm.sock -pass-header Authorization
<FilesMatch \.php$>
SetHandler application/x-httpd-php
Action application/x-httpd-php /php7-fcgi
</FilesMatch>
sudo systemctl restart apache2.service
#_ Konfigurasi VirtualHost pada Gambar 1 menggunakan socket untuk menghubungkan Apache dengan PHP-FPM yang berada dalam satu server yang sama. Bila Apache dengan PHP-FPM berada dalam server yang terpisah maka anda harus menggunakan koneksi TCP/IP, namun cara tersebut tidak dibahas dalam artikel ini.
#_Tanpa langkah berikut, sebenarnya instalasi PHP tersebut telah dapat digunakan, namun kadang kita perlu melakukan beberapa modifikasi untuk menyesuaikan dengan kebutuhan program PHP yang nantinya kita buat.
#_Modifikasi bagian cgi.fix_pathinfo sangat penting dilakukan demi alasan keamanan. Yang perlu kita lakukan adalah membuka file /etc/php/7.0/fpm/php.ini dan mengubah
;cgi.fix_pathinfo=1
menjadi
cgi.fix_pathinfo=0
#_kemudian me-restart service PHP-FPM dengan perintah
$ sudo systemctl restart php7.0-fpm.service
#_Modifikasi ini sangat penting dilakukan untuk mencegah PHP mengeksekusi file dengan nama yang paling mirip
#_Bila ingin menggunakan PHP untuk mengolah RDBMS MySQL atau MariaDB, maka anda perlu mengaktifkan PHP MySQL module
sudo apt install php-mysql
sudo systemctl restart php7.0-fpm.service
#_buatlah sebuah file di root directory server, misalnya /var/www/html/mysql.php dengan isi
<?php
$servername = "localhost";
$username = "root";
$password = "secret";
$conn = new mysqli($servername, $username, $password);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
} else {
echo("Connection success.");
}
$conn->close();
?>
#_Untuk meningkatkan fungsionalitas dari PHP, anda dapat menambahkan beberapa modul tambahan ke dalam PHP.
$ sudo apt-cache search php-
$ sudo apt-cache search php- | grep zip
libphp-pclzip - transitional dummy package
php-bz2 - bzip2 module for PHP [default]
php-pclzip - ZIP archive manager class for PHP
php-zip - Zip module for PHP [default]
php-zipstreamer - Stream zip files without i/o overhead
php7.0-bz2 - bzip2 module for PHP
php7.0-zip - Zip module for PHP
sudo apt install php-zip
sudo systemctl restart php7.0-fpm.service
#_Bila anda tidak menginginkan versi PHP anda tampil pada HTTP Header,
#_maka dapat memodifikasi file /etc/php/7.0/fpm/php.ini dan /etc/php/7.0/cli/php.ini
expose_php = Off
#_melalui file /etc/apache2/mods-available/dir.conf.
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
sudo systemctl restart apache2.service
https://medium.com/@dataq/instalasi-apache-dan-php-fpm-pada-ubuntu-16-04-cd8900b5d529
>>>>>>>>>>>>>>>
yum update && yum install httpd mariadb mariadb-server *yum os
aptitude update && aptitude install apache2 mariadb-server mariadb-client mariadb.common *debian
wget https://downloads.php.net/~ab/php-7.0.0RC1.tar.gz
tar xzf php-7.0.0RC1.tar.gz -C /opt
cd /opt/php-7.0.0RC1.tar.gz
./buildconf --force
# ./configure \
--prefix=$HOME/php7/usr \
--with-config-file-path=$HOME/php7/usr/etc \
--enable-mbstring \
--enable-zip \
--enable-bcmath \
--enable-pcntl \
--enable-ftp \
--enable-exif \
--enable-calendar \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-curl \
--with-mcrypt \
--with-iconv \
--with-gmp \
--with-pspell \
--with-gd \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--with-zlib-dir=/usr \
--with-xpm-dir=/usr \
--with-freetype-dir=/usr \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-openssl \
--with-pdo-mysql=/usr \
--with-gettext=/usr \
--with-zlib=/usr \
--with-bz2=/usr \
--with-recode=/usr \
--with-mysqli=/usr/bin/mysql_config \
--with-apxs2
#_configure: error: no acceptable C compiler found in $PATH see 'config.log' for more details
yum install gcc
aptitude install gcc
#_configure: error: xml2-config not found. Please check your libxml2 installation.
gcc
libxml2-devel
pkgconfig
openssl-devel
bzip2-devel
curl-devel
libpng-devel
libpng-devel
libjpeg-devel
libXpm-devel
freetype-devel
gmp-devel
libmcrypt-devel
mariadb-devel
aspell-devel
recode-devel
httpd-devel
yum install gcc libxml2-devel pkgconfig openssl-devel bzip2-devel libpng-devel libpng-devel libjpeg-devel libXpm-devel freetype-devel gmp-devel libmcrypt-devel mariadb-devel aspell-devel recode-devel httpd-devel
make
make install
#_debian
apt-get install make libxml2-dev libcurl4-openssl-dev libjpeg-dev libpng-dev libxpm-dev libmysqlclient-dev libicu-dev libfreetype6-dev libxslt-dev libssl-dev libbz2-dev libgmp-dev libmcrypt-dev libpspell-dev librecode-dev apache2-dev
ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h
make
make install
ls -l /opt/php-7.0.0RC1 | grep php.ini
cp /opt/php-7.0.0RC1/php.ini-development /usr/local/lib
/etc/httpd/conf/httpd.conf *yum
/etc/apache2/apache2.conf *deb
LoadModule php7_module /usr/lib64/httpd/modules/libphp7.so
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
#_ debi omit the LoadModule line & also need to remove & create the follow symbolic links to the indicated Apache modules
cd /etc/apache2
rm mods-enabled/mpm_event.conf
rm mods-enabled/mpm_event.load
ln -s mods-available/mpm_prefork.conf mpm_prefork.conf
ln -s mods-available/mpm_prefork.load mpm_prefork.load
# systemctl restart httpd [On CentOS 7 box]
# systemctl restart apache2 [On Debian 8 box]
---------------------
#yum -y update
#yum install net-snmp net-snmp-utils -y
#systemctl enable snmpd
#systemctl restart snmpd
#sudo yum install firewalld
#sudo systemctl enable firewalld
#mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.orig
#systemctl restart firewalld
#firewall-cmd --permanent --add-port=161/udp
#firewall-cmd --reload
#firewall-cmd --list-all
######echo -e "# sec.name source community\ncom2sec notConfigUser default @lawangs18\n
####\n# Second, map the security name into a group name:\n
# We do not want annoying "Connection from UDP: " messages in syslog.\n# If the following option is commented out, snmpd will print each incoming\n
# connection, which can be useful for debugging.\ndontLogTCPWrappersConnects yes" > /etc/snmp/snmpd.conf
https://docs.joomla.org/Configuring_a_LAMPP_server_for_PHP_development/Linux_desktop
sudo apt-get install apache2 php5-mysql libapache2-mod-php5 mysql-server phpmyadmin php5-curl
cek localhost after install
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/test.php
Apache Default Web Site Folder
Location: "/var/www/"
Apache Web Sites Configuration Files
Location: /etc/apache2/sites-available/
Apache Configuration Files
Location: "/etc/apache2/apache2.conf" Location: "/etc/apache2/envvars"
Apache Ports Configuration File
Location: "/etc/apache2/ports.conf"
Apache Log Files
Location: "/var/log/apache2/"
Configuration
Enabling mod_rewrite
The mod_rewrite module uses a rule-based rewriting engine based on a PCRE regular-expression parser to rewrite requested URLs on the fly. By default, mod_rewrite maps a URL to a filesystem path. However, it can also be used to redirect one URL to another URL, or to invoke an internal proxy fetch.
For more information, visit http://httpd.apache.org/docs/current/mod/mod_rewrite.html
sudo a2enmod rewrite
sudo service apache2 restart
Deploying a New Site Folder Structure
By default the Web server is hosting the files in the location "/var/www", but for security reasons
and to avoid ownership problems, we are going to use another place to host our Website files.
Let's create a new folder to store the Web files and the log files of the site.
mkdir /home/youruser/lamp/
mkdir /home/youruser/lamp/public_html/
mkdir /home/youruser/lamp/logs/
NOTE: You can place your new site folders at any location; this is just an example. Replace "youruser" with an actual Linux username.
To store the Website files we are going to use the folder "public_html". For our log files, we are going to use the folder "logs".
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/mydevsite.conf
NOTE: "mydevsite" is the name of the new site used in this example. You can use any other name you like.
sudo gedit /etc/apache2/sites-available/mydevsite.conf
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined