2025-04-25 で設置したMastodonと同じUbuntuサーバーに、現在CentOSに載っているWebサイトを引っ越す。
> pwd
/home/negla
> cd .ssh
> touch config
> vi config
config
host github.com
HostName github.com
IdentityFile {path-to-key}
User git
> pwd
/home/negla
> mk dir files
> cd files
> git clone git@github.com:negla64/app.git
> sudo mv app /usr/share/nginx/html/www
> cd
> ln -s /usr/share/nginx/html html
> cd html
> cd /etc/nginx/sites-available
> vi cigneg.conf
cigneg.conf
server {
listen 80;
server_name migrate.cigneg.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name migrate.cigneg.com;
root /usr/share/nginx/html/www/app/public;
index index.php index.html;
ssl_certificate /etc/letsencrypt/live/cigneg.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/cigneg.com/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
access_log /var/log/nginx/cigneg_access.log;
error_log /var/log/nginx/cigneg_error.log;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
> sudo nginx -t
> sudo systemctl reload nginx
> create user '{user-name}'@'{接続の範囲}' identified by '{password}';
> create database {db-name};
> user {db-name};
> select @@character_set_database, @@collation_database;
+--------------------------+----------------------+
| @@character_set_database | @@collation_database |
+--------------------------+----------------------+
| utf8mb4 | utf8mb4_general_ci |
+--------------------------+----------------------+
> grant all on {db-name}.* to '{user-name}'@'{接続の範囲}';
SSHトンネル
項目 | 値/他 |
---|---|
Host | {ip-address} |
User | {sshのuser} |
Port | {sshのport} |
認証 | 鍵指定 |
接続
項目 | 値/他 |
---|---|
Host | localhost |
Port | {MariaDBのport} |
認証 | ユーザーとパスワード |
User | {user-name} |
Password | {password} |
DB | {db-name} |
伏せ字ばかりでメモを取る意味がない感触もありつつ、意図としてはSSHトンネルを使っているのでHost指定はlocalhostで良いんだよのメモ。
PHP入ってない。うん、入れた記憶もない。
> php -v
Command 'php' not found, but can be installed with:
apt install php8.3-cli # version 8.3.6-0ubuntu0.24.04.3, or
apt install php-cli # version 2:8.2+93ubuntu1
apt install php8.2-cli # version 8.2.12-1ubuntu2
Ask your administrator to install one of them.
> apt install php8.3-cli
> php -v
PHP 8.3.6 (cli) (built: Mar 19 2025 10:08:38) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.6, Copyright (c) Zend Technologies
with Zend OPcache v8.3.6, Copyright (c), by Zend Technologies
> apt install php8.3-fpm
> php-fpm8.3 --version
PHP 8.3.6 (fpm-fcgi) (built: Mar 19 2025 10:08:38)
Copyright (c) The PHP Group
Zend Engine v4.3.6, Copyright (c) Zend Technologies
with Zend OPcache v8.3.6, Copyright (c), by Zend Technologies
色々いれる(実際にはcomposerを叩いた時やLaravelのエラー文言を読みながら不足したものを入れていった)
> apt install php8.3-curl
> apt install php8.3-xml
> apt install zip unzip p7zip-full php-zip
> apt autoremove
> systemctl start php8.3-fpm
> systemctl enable php8.3-fpm
MariaDBドライバ(MySQL共通)
> apt install php8.3-mysql
> systemctl restart php8.3-fpm
> composer --version
Command 'composer' not found, but can be installed with:
apt install composer
Please ask your administrator.
以下に従う
Composer
> composer --version
Composer version 2.8.8 2025-04-04 16:56:46
PHP version 8.3.6 (/usr/bin/php8.3)
Run the "diagnose" command to get more detailed diagnostics output.
> composer diagnose
> composer
相変わらず chmod や chown 方面が不得手。無駄とか穴とかありそうだけど私以外SSHしようもないので大丈夫。
path | chmod | chown |
---|---|---|
/app/composer.lock | 664 | negla:negla |
/app/bootstrap/cache | 755 | www-data:www-data |
/app/storage | 775 | www-data:www-data |
/app/storage/logs | 777 | www-data:www-data |
/app/storage/logs/laravel.log | 644 | www-data:www-data |
/app/storage/framework/cache | 777 | www-data:www-data |
/app/storage/framework/cache/data | 777 | www-data:www-data |
/app/storage/framework/views | 777 | www-data:www-data |
compoer を root や sudo で叩くなとアラートが出る。後でちゃんと読もう。
https://getcomposer.org/root
artisan あれこれ
> php artisan key:generate
> php artisan migrate
> php artisan config:clear
> php artisan route:clear
> php artisan cache:clear
> php artisan view:clear
Topページが /public/blog 在りきで書かれているので無いとタイムアウトになる。
> cd /home/negla/html/www/app/public
> mkdir blog
> mkdir lib
> mkdir bluemap
1から4まではテンポよくやらないとな。他は急がない。