d-shimizu / book-web-performance-tuning

達人が教えるWebパフォーマンスチューニング 〜ISUCONから学ぶ高速化の実践
0 stars 0 forks source link

php 実装に切り替える #2

Open d-shimizu opened 2 years ago

d-shimizu commented 2 years ago

ruby 実装停止

$ sudo systemctl stop isu-ruby

php-fpm 実装起動

$ sudo systemctl start php7.4-fpm

Nginx 設定変更

$ unlink /etc/nginx/sites-enabled/isucon.conf
$ sudo ln -s /etc/nginx/sites-available/isucon-php.conf /etc/nginx/sites-enabled/isucon.conf

複数台とする場合

server { listen 80;

client_max_body_size 10m;
root /home/isucon/private_isu/webapp/public;

location / {
    try_files $uri /index.php$is_args$args;
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php {
    root /home/isucon/private_isu/webapp/php;
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param SCRIPT_NAME $fastcgi_script_name;
    fastcgi_index index.php;
    #fastcgi_pass 10.128.1.7:9000;
    fastcgi_pass php-fpm;
}

}