View Single Post
  #1  
Old 22nd May 2023, 15:14
MasterPlebien's Avatar
MasterPlebien MasterPlebien is offline
Member
 
Join Date: May 2023
P2P
Posts: 4
Default [HOW-TO] Install NexusPHP 1.8.0 and above
Hey guys, I've been experimenting with this script which appears to still be actively maintained here: https://github.com/xiaomlove/nexusphp and hopefully we will be able to help each other out here as well.

Here's a quick installation guide for anyone else who's interested.

I'll be using Ubuntu Server with aaPanel (FOSS). If you are not using aaPanel, and doing manual installation of Nginx, MySQL etc, take note of the PHP_USER and ROOTPATH used below.

Requirements:
PHP => 8.0
MySQL => 5.7
Redis => 2.6.12
Extensions: bcmath, ctype, curl, fileinfo, json, mbstring, openssl, pdo_mysql, tokenizer, xml, mysqli, gd, redis, pcntl, sockets, posix, gmp, zend opcache

1) Update you Linux Server
Code:
apt update
apt upgrade
apt clean
 apt autoremove
2) Install some additional packages unless you have your preferred ones
Code:
apt install screen wget curl vim
3) Install aaPanel
Code:
wget -O install.sh http://www.aapanel.com/script/install-ubuntu_6.0_en.sh && bash install.sh aapanel
4) Enter aaPanel from your browser.
5) Use the one-click install option to install Nginx, mysql, pure-ftpd, php8 and phpmyadmin.
6) After installation is done, head over to "App Store" in aaPanel and select settings for PHP.
8) Under PHP setings, navigate to Install extensions and installing the following extensions:
Code:
fileinfo
opcache
redis
 gmp
9) Under PHP settings, navigate to Disabled functions and delete the following:
Code:
proc_open
exec
putenv
 symlink
10) Restart PHP
11) Navigate to "Files" in aaPanel
12) Download the latest release of NexusPHP from https://github.com/xiaomlove/nexusphp/releases using the remote download button.
13) Right-click the .zip file that was downloaded and select unzip. Rename the folder that was extracted to a preferred name. In this case, I'll name it nexusphp.
14) Now, head over to "Databases" in aaPanel and add a database.
15) Head over to "Websites" and select "Add site", input the detailed and submit.
Code:
Domain name: Enter your domain/ip
Description: Enter any description 
Website Path: Your root path, for me its /www/wwwroot/nexusphp as i named my folder nexusphp earlier on.
FTP: Not required unless you need it
Database: Not needed now, we will create it during the installation of the site.
PHP version: PHP 8.0 or above.
14) Click submit


15) Click "Conf" under Operation and do the following:
Code:
Nagivate to Site Directory, untick Anti-XSS attack.


Ensure, Site Directory is pointing to your root path /www/wwwroot/nexusphp


 Running directory is set to /public
16) Now head over to "Config" and insert the following code:
Code:
location / {
    index index.html index.php;
    try_files $uri $uri/ /nexus.php$is_args$args;
}

# Filament
location ^~ /filament {
    try_files $uri $uri/ /nexus.php$is_args$args;
}
17) Click save and close the windows, we can now proceed with the creation of the installer for your site.

18) Using your terminal navigate to your root path
Code:
cd /www/wwwroot/nexusphp
19) Now to create the installer using composer.
Code:
composer install
20) Copying the install folder to the public folder.

Code:
cp -R nexus/Install/install public/
21) To change the owner/permission of your root folder to PHP user. If you are using aaPanel, your PHP_USER will be www.

Code:
chown -R PHP_USER:PHP_USER ROOT_PATH
22) If you are not using aaPanel and you don't know your PHP user you can also give the entire directory 0777 permission as such. However, this method is unadvisable.
Code:
chmod -R 0777 ROOT_PATH
23) You can now head over to your website/ip to start the installation of the website and creation of your admin account.

But before that, we have to create some cronjobs and daemons to keep the site running and maintained.

24) Create these 2 cronjobs to keep the website running, setup the following cronjobs by heading over to "Cron" in aaPanel:
Code:
Type of Task: Shell Script
Name of Task: Schedule Cron
Execution Cycle: 1 Minute
Script content: su -c "cd /www/wwwroot/nexusphp && php artisan schedule:run >> /tmp/schedule_nexusphp.log" -s /bin/sh www


Type of Task: Shell Script
Name of Task: CLI Cleanup Cron
Execution Cycle: 1 Minute
Script  content: su -c "cd /www/wwwroot/nexusphp && php include/cleanup_cli.php >> /tmp/cleanup_cli_nexusphp.log" -s /bin/sh www
25) Head over to "App Store", install the app "Supervisor" and Add a daemon:
Code:
Name: nexus-queue
Run user: www
Run dir: /www/wwwroot/nexusphp
Start command: php /www/wwwroot/nexusphp/artisan queue:work --tries=3 --max-time=3600
Processes: Input the number of processes your server has. In my case, my server has a dual-core CPU. Therefore, it is 2.
Your site should now be fully functional


Credits:
NexusPHP: https://github.com/xiaomlove/nexusphp
NexusPHP Docs: https://doc.nexusphp.org/en/installa...et-the-program
Reply With Quote
The Following User Says Thank You to MasterPlebien For This Useful Post:
papad (23rd May 2023)