chivincent
就只是個宅正太(?)
Muzik Online
PHP Runtime
Database
Web Server
I want index.html
Here is index.html
I want index.php
.php?
By pass to PHP-FPM
Return the result
index.php
Here is index.php
I want index.php
I need some data from database
Here is the data you want
Here is index.php
是的,就這樣,沒有其它的
$ ssh-keygen -t rsa -b 4096 -C "username@hostname"
$ ssh root@{ip-address}
> apt update
> apt upgrade
> apt install php7.2 \
php7.2-cli \
php7.2-common \
php7.2-mbstring \
php7.2-xml \
php7.2-mysql \
php7.2-zip
> apt install composer
> composer g require "laravel/installer"
> echo 'export PATH="$HOME/.config/composer/vendor/bin:$PATH"' \
>> ~/.bashrc
> laravel new test-laravel
> cd test-laravel
> php artisan serve --host 0.0.0.0
> apt install docker.io
> docker run --name mariadb \
-p 3306:3306 \
-d \
-e MYSQL_ROOT_PASSWORD=root \
-e MYSQL_DATABASE=test \
-e MYSQL_USER=homestead \
-e MYSQL_PASSWORD=secret \
mariadb \
--character-set-server=utf8mb4 \
--collation-server=utf8mb4_unicode_ci
> docker run --name redis \
-p 6379:6379 \
-d \
redis
> git clone https://github.com/chivincent/nfu-workshop.git
> cd nfu-workshop/
> composer install
> yarn install
> yarn run dev
> php artisan migrate
> php artisan serve --host 0.0.0.0
> useradd {your-user-name}
> passwd {your-user-name}
> usermod -aG wheel {your-user-name}
> cd /home/{your-user-name}
> mkdir .ssh
> echo "{your-ssh-public-key}" > authorized_keys
$ ssh {your-user-name}@{ip-address}
server {
listen 80;
server_name nfu-workshop.test;
root /var/www/nfu-workshop/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
> sudo chcon -Rt httpd_sys_content_t \
/var/www/nfu-workshop
> sudo chcon -Rt httpd_sys_rw_content_t \
/var/www/nfu-workshop/storage
> sudo chcon -Rt httpd_sys_rw_content_t \
/var/www/nfu-workshop/bootstrap/cache
> sudo /usr/sbin/setsebool httpd_can_network_connect=1
# File Path: /etc/systemd/system/laravel-queue-worker.service
[Unit]
Description=Laravel queue worker
[Service]
User=www
Group=www
Restart=on-failure
ExecStart=/usr/bin/php /var/www/nfu-workshop/artisan queue:work --sleep=3 --tries=3
[Install]
WantedBy=multi-user.target
* * * * * /usr/bin/php /var/www/nfu-workshop/artisan schedule:run >> /dev/null 2>&1
By chivincent