Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How I actually got Polr to install on NGINX & Created the databases & Create an admin user #633

Open
JoeBoll opened this issue Apr 21, 2023 · 1 comment

Comments

@JoeBoll
Copy link

JoeBoll commented Apr 21, 2023

First let's put some errors here so you can find this post:

  • Whoops, looks like something went wrong.
  • Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.0.0".
  • Blank Page, empty page, nothing loading, root domain.
  • Can't create admin user, how do I add a user to the database, how do I add myself as an admin, how do I create an admin account?

So first off, I used CloudPanel (like cPanel, but free)
And super easy to install from digital ocean: https://marketplace.digitalocean.com/apps/cloudpanel-2-ubuntu-22.04

It is NGINX, has PHPmyAdmin, Database creation, automatic vhost setup.
(like I said, pretty much cPanel)

Credit where credit is due: ChatGPT4 helped a lot.

  1. Create an A record with your webhost with the content: [the IP address of your cloudpanel machine]
  2. Create the site on cloudpanel
  3. Set the root directory in cloud panel to [your.site.url]/polr/public
  4. In the SSL/TLS tab click Actions -> New let's encrypt certificate (assuming your A record has had time to setup, this step can be done later if needed)
  5. SET the PHP VERSION TO 7.4 on cloudpanel
  6. I used the cloudpanel default VHOST file (but it put it down below because I <3 u)
  7. SSH into your machine
  8. sh - [insert the site username] (this changes you from root to the site user, so all the permissions will be right, type exit if you need to do something as root)
  9. cd to htdocs
  10. cd to [your site folder]
  11. git clone https://github.com/cydrobolt/polr.git --depth=1
  12. chmod -R 755 polr
  13. chown -R www-data polr (you might have to exit to do this)
  14. curl -sS https://getcomposer.org/installer | php
  15. rm composer.lock
    (So far this install has pretty much followed the instructions)
  16. php7.4 composer.phar install --no-dev -o (Does NOT work with 8, you will get a blank screen)
  17. Using the cloudpanel interface I created a mySQL database, user, and password for said user.
  18. cp .env.setup .env
  19. nano .env
  20. Remove the # in front of any lines
  21. Enter your mySQL database, user, and password, making sure not to leave a space, and not to confuse the database and user with each other.
  22. Save the file with Ctrl+x then Y then Return
  23. php artisan migrate --force (this will create a database)
  24. Now go to [your.site.URL]/setup
  25. Enter your mySQL database, user, and password, as well as your username and password (mine didn't save here, but hey maybe you're lucky), as well make SURE you have the 'Anyone can sign up' setting set to allow anyone to sign up. (We will disable this later, but you will need it next), also I turned off 'Anyone can create a link without signup'.
  26. Then click create, it will probably tell you the setup is already complete
  27. Create an account on YOUR.WEBSITE.URL (the site you just created)
  28. Now in CloudPanel in the Databases tab, there is a phpMyAdmin row for the user, click the Manage button.
  29. In PHPMyAdmin, find the 'users' table in the left coloum.
  30. There will be a user in there (it's yours!), you need to change one thing, click edit, scroll down and find the role field, type 'admin' (make sure you type it right, no quotes, just the word) You just made yourself an admin! Yay
  31. nano .env
  32. Now change the following if you want:

POLR_ALLOW_ACCT_CREATION=0 (this will disable anyone signing up)
SETTING_SHORTEN_PERMISSION=true (this will require an account to shorten a link)
As well as anything else you'd like to change. SMTP settings maybe? If you need email password recovery.

It should now be working.

Here's my VHOST file

(make sure to replace BOTH YOUR.WEBSITE.URL s)
`
server {
listen 8080;
listen [::]:8080;
server_name YOUR.WEBSITE.URL;
{{root}}

try_files $uri $uri/ /index.php?$args;
index index.php index.html;

location ~ .php$ {
include fastcgi_params;
fastcgi_intercept_errors on;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
try_files $uri =404;
fastcgi_read_timeout 3600;
fastcgi_send_timeout 3600;
fastcgi_param HTTPS "on";
fastcgi_param SERVER_PORT 443;
fastcgi_pass 127.0.0.1:{{php_fpm_port}};
fastcgi_param PHP_VALUE "{{php_settings}}";
}

if (-f $request_filename) {
break;
}
}

server {
listen 80;
listen [::]:80;
listen 443 ssl http2;
listen [::]:443 ssl http2;
{{ssl_certificate_key}}
{{ssl_certificate}}
server_name YOUR.WEBSITE.URL;
{{root}}

{{nginx_access_log}}
{{nginx_error_log}}

if ($scheme != "https") {
rewrite ^ https://$host$uri permanent;
}

location ~ /.well-known {
auth_basic off;
allow all;
}

{{settings}}

location / {
{{varnish_proxy_pass}}
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_hide_header X-Varnish;
proxy_redirect off;
proxy_max_temp_file_size 0;
proxy_connect_timeout 720;
proxy_send_timeout 720;
proxy_read_timeout 720;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
proxy_temp_file_write_size 256k;
}

location ~* ^.+.(css|js|jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|woff2|eot|mp4|ogg|ogv|webm|webp|zip|swf|map)$ {
add_header Access-Control-Allow-Origin "*";
expires max;
access_log off;
}

if (-f $request_filename) {
break;
}
}
`

@minecraftchest1
Copy link

You are running a version on PHP that is to old. You need 8.0.0 or newer

* Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.0.0".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants