Upload files to "/"

This commit is contained in:
Puneet Khurana 2025-03-26 10:20:03 +00:00
parent d57cb7143a
commit 47ee1ec2b2
5 changed files with 100 additions and 0 deletions

28
Apache.conf.sh Normal file
View File

@ -0,0 +1,28 @@
# Apache.conf.sh
user Apache;
worker_processes auto;
pid /run/Apache.pid;
include /etc/Apache/modules-enabled/*.conf;
events {
worker_connections 1024;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/Apache/mime.types;
default_type application/octet-stream;
access_log /var/log/Apache/access.log;
error_log /var/log/Apache/error.log;
gzip on;
gzip_disable "msie6";
include /etc/Apache/conf.d/*.conf;
}

19
Apache:default.conf.sh Normal file
View File

@ -0,0 +1,19 @@
# default.conf.sh
server {
listen 80;
server_name localhost;
root /var/www/html;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass php-fpm:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}

7
app:db_init.sql Normal file
View File

@ -0,0 +1,7 @@
CREATE TABLE IF NOT EXISTS greetings (
id INT AUTO_INCREMENT PRIMARY KEY,
message VARCHAR(255) NOT NULL
);
INSERT INTO greetings (message) VALUES ('Hello, Im puneet khurana from MySQL tech team !');

42
app:index.php Normal file
View File

@ -0,0 +1,42 @@
<?php
$servername = "my_mysql";
$username = "user";
$password = "password";
$database = "my_database";
$conn = new mysqli($servername, $username, $password, $database);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "<h2>Connected successfully to MySQL!</h2>";
$sql = "CREATE TABLE IF NOT EXISTS test_table (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(50) NOT NULL
)";
$conn->query($sql);
$sql = "SELECT COUNT(*) AS count FROM test_table";
$result = $conn->query($sql);
$row = $result->fetch_assoc();
if ($row['count'] == 0) {
$conn->query("INSERT INTO test_table (name) VALUES ('Alice'), ('Bob'), ('Charlie')");
}
$sql = "SELECT * FROM test_table";
$result = $conn->query($sql);
echo "<h3>Database Data:</h3><ul>";
while ($row = $result->fetch_assoc()) {
echo "<li>ID: " . $row["id"] . " - Name: " . $row["name"] . "</li>";
}
echo "</ul>";
$conn->close();
?>

4
test.php Normal file
View File

@ -0,0 +1,4 @@
<?php
phpinfo();
?>