Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
devops-intern-labs
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Nam
devops-intern-labs
Commits
0c699350
Commit
0c699350
authored
Jan 12, 2024
by
Vũ Hoàng Nam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create file shell script install Nginx, MySQL, PHP, Wordpress on Ubuntu
parent
7b199f38
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
0 deletions
+62
-0
install.sh
Week1&2/install.sh
+62
-0
wordpress.sh
Week1&2/wordpress.sh
+0
-0
No files found.
Week1&2/install.sh
0 → 100644
View file @
0c699350
#!/bin/bash
# Update package list
sudo
apt update
# Install NGINX
sudo
apt
install
-y
nginx
# Install MySQL and secure installation
sudo
apt
install
-y
mysql-server
sudo
mysql_secure_installation
# Install PHP and required extensions
sudo
apt
install
-y
php-fpm php-mysql
# Configure NGINX to use PHP
sudo mv
/etc/nginx/sites-available/default /etc/nginx/sites-available/default_backup
sudo
bash
-c
'cat > /etc/nginx/sites-available/default <<EOF
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
EOF'
# Reload NGINX to apply changes
sudo
systemctl reload nginx
# Create a test PHP file
echo
"<?php phpinfo(); ?>"
|
sudo tee
/var/www/html/info.php
# Install WordPress
sudo
apt
install
-y
unzip
wget https://wordpress.org/latest.zip
unzip latest.zip
sudo mv
wordpress/
*
/var/www/html/
sudo chown
-R
www-data:www-data /var/www/html/
# Cleanup
rm
-rf
wordpress latest.zip
# Provide instructions to the user
echo
"NGINX, MySQL, PHP, and WordPress have been installed successfully."
Week1&2/wordpress.sh
0 → 100644
View file @
0c699350
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment