Langsung ke konten utama

How to run PHP in nginx and fix the errors

first you gonna need to backup the conf file in order when you did something wrong, who knows tho?

and then edit them;
dunno wheres the config file located?
just run nginx -t and it will show you wheres the conf file and its content.
now just edit it with the following:

put root YOUR_INDEX_ROOT; at the top and inside of http { params
the purpose is to set it as global root directory.
and within location ~ \.php$ { edit with the following params:
try_files $uri =404; # try to find the file, if fail throw 404 error
            #root           /data/data/com.termux/files/home/sdcard/www; # this is the root dir of php files
            fastcgi_pass   unix:/data/data/com.termux/files/usr/var/run/php-fpm.sock; # pass every php file to this server
            fastcgi_index  index.php; # the index file name
            #fastcgi_split_path_info ^(.+\.php)(/.+)$; # ?
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name; # param for fastcgi to find the script
            include        /data/data/com.termux/files/home/sdcard/www/nginx/fastcgi_params;
        }

okay then save it and if everything's fine you can run php-fpm by just type php-fpm and hit enter in terminal.

note:
you can also set the fastcgi_pass value to a server addr.
but it seems that php-fpm always use socket file in the first place rather than a server addr.

Komentar

Postingan populer dari blog ini

How to export Godot game to Android from Linux

1.Go to Editor -> Manage export template -> Download and install ->Close. 2.Download command-tools cli for linux at https://developer.android.com/studio/ # command-tools .  Scroll down until you see the Command line tools  section. Then add `export ANDROID_HOME="/path/to/android-sdk"`  to your  `.bashrc`  or  `.zshrc` (for other shell, try to edit it accordingly), and unzip the file to: `/path/to/android-sdk/` Example: `$HOME/Android/android-sdk` 3.Download Openjdk latest version. Set JAVA _HOME  to your `.bashrc` : `export JAVA_ HOME=$(which java|rev|cut -d'/' -f3-|rev)` Install required tools&packages from sdkmanager: `$ANDROID _HOME/cmdline-tools/bin/sdkmanager --sdk_ root=$ANDROID_HOME "platform-tools" "build-tools;34.0.0" "platforms;android-34" "cmdline-tools;latest"` "cmake;3.10.2.4988404" "ndk;23.2.8568313" You can also choose which version you want to download, just playing around wi...

How to make J2ME Apps On Termux

To make J2ME Apps or maybe games, you will need to install OpenJDK (done via `apt install openjdk-xx` xx is the version number), Download the CLDC&MIDP jar files (download them from  jarcasting ). Create a new java file for the main program, called HelloMIDlet.java: ``` import javax.microedition.lcdui.*; import javax.microedition.midlet.*; public class HelloMIDlet extends MIDlet {         private Display display;         private Form form;         public HelloMIDlet() {                 form = new Form("Hello World from J2ME!");         }         protected void startApp() {                 display = Display.getDisplay(this);                    form.append(new StringItem("Message:", "Hello, World!"));              ...

Cara install app/games yang tidak kompatibel di playstore

  tutor download atau beli game (graveyard keeper) yg tidak support di hp tanpa ribet: buka web playstore lalu login akun google kalian dan cari app/game yg dicari, misal graveyard keeper. klik beli dan pilih pembayaran (misal QRIS) dan selesaikan sampai muncul notif seperti di bawah. download aurora store, install dan beri ijin yg diperlukan (install app dan penyimpanan), login ke akun google kalian lalu cari app/game tadi dan langsung install aja. kalo ada pop up app tidak kompatibel, klik tombol selengkapnya dan proceed anyway. note: aurora store sering dipake buat install app/games yg tidak support atau tidak ada.