note 127148 added to install.unix.nginx
| From: | timy dot shark at main dot php dot net | Date: | Mon, 30 May 2022 19:33:33 +0000 |
| Subject: | note 127148 added to install.unix.nginx | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-218547@lists.php.net to get a copy of this message | ||
Great effort for this tutorial, thanks a ton, here are my notes if may help anyone, considering
default install on WSL2 container
Note: composer added for Laravel framework.
These are NOT to be copy and pasted as it is, need to be selective as there are annotations beside
some commands,
Also I've commented # some of the defaults written by the original editor due to mismatch to my
current environment.
sha256sum php-x.x.x.tar.gz => e847745fd66fc8c57fac993a609fefcded93fddccd225f0620a26bb5ae5753c3
tar zxf php-x.x.x
sudo apt install build-essential
sudo apt install -y composer nginx pkgconf libxml2-dev libsqlite3-dev zlib1g-dev
cd php-x.x.x
./configure --enable-fpm --with-mysqli <==Thank you for installing PHP.
make <== takes a while
sudo make test <== optional as recommended
sudo make install <= /usr/local/bin /usr/local/php
sudo cp php.ini-development /usr/local/lib/php.ini
sudo cp /usr/local/etc/php-fpm.d/www.conf.default /usr/local/etc/php-fpm.d/www.conf
sudo cp sapi/fpm/php-fpm /usr/local/bin
sudo vim /usr/local/php/php.ini <= cgi.fix_pathinfo=0
sudo vim /usr/local/etc/php-fpm.d/www.conf <= user=www-data group=www-data
sudo vim sapi/fpm/php-fpm.conf <= edit include=etc/php-fpm.d/*.conf <- relative path
sudo cp sapi/fpm/php-fpm.conf /usr/local/etc
/usr/local/bin/php -v <= $PATH$ uses /usr/local/bin at first /usr/local/lib/php.ini
sudo /usr/local/bin/php-fpm <= start the service
sudo vim /etc/nginx/sites-available/default <= edit the following under server {}
location / {
#root html;
#index index.php index.html index.htm;
}
location ~* \.php$ {
#fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
*Restart nginx (root /var/www/html) if root path doesn't exist, default is:
/usr/share/nginx/html
sudo nginx -t <= Test Nginx conf files
sudo service nginx reload
sudo service nginx stop
sudo service nginx start <= [OK]
php-fpm needs to be in a service, or kill process manually ps -aux | grep php-fpm ; kill <pid>
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.12.131 (proxied: 2001:569:5401:3700:ad74:e086:295a:396b)
----
Manual Page -- https://php.net/manual/en/install.unix.nginx.php
Edit -- https://main.php.net/note/edit/127148
Del: integrated -- https://main.php.net/note/delete/127148/integrated
Del: useless -- https://main.php.net/note/delete/127148/useless
Del: bad code -- https://main.php.net/note/delete/127148/bad+code
Del: spam -- https://main.php.net/note/delete/127148/spam
Del: non-english -- https://main.php.net/note/delete/127148/non-english
Del: in docs -- https://main.php.net/note/delete/127148/in+docs
Del: other reasons-- https://main.php.net/note/delete/127148
Reject -- https://main.php.net/note/reject/127148
Search -- https://main.php.net/manage/user-notes.php