Hi, I was testing nginx with dynamic modules from https://launchpad.net/~hda-me/+archive/ubuntu/nginx-stable but I could not get php7.1-fmp wordking. Nginx works, modules works but not php. I am not to knowledgeable is server management. I followed this tutorial except for nginx that I installed from ppa and mariadb instead of mysql: https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-in-ubuntu-16-04 Something is missing but I don’t know what?
Thank you
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
@stephgiguere
Generally this section:
… would look something like:
The difference being we’re swapping
snippets/fastcgi-php.conf
withfastcgi_params
.Not all NGINX repositories have a
snippets
directory that contains blocks of code. Even if they do, not all of them contain everything that’s needed (at least, that has been my experience).…
If you don’t mind trying something different, and you have a few extra minutes, I wrote and installer for NGINX that handles a source installation hands-free.
It includes HTTP2, Brotli, a few modules, and multiple example configurations with it.
If you run:
Then:
Followed by:
And finally:
You’ll have a fully configured and optimized NGINX setup with a working PHP configuration that you can copy from the
./installers/nginx/examples
directory.Within this directory there’s a
php
directory which contains aphp.conf
file. That’s the one you need and to set it up, all you’d do is:Then:
… and configure it to your liking. There’s also examples on how to setup SSL, Load Balancing, Proxy, and others.
The installer will take about 20-30 minutes as this is a source compile, not a stock repo package. It’s detailed and sets up everything you’d have to do a source compile to setup. A
systemd
service is also included, so NGINX is controlled using:The only thing I’d recommend doing is:
1). Run the installer on a fresh Ubuntu 16.04 droplet, or; 2). Run:
This wipes your current NGINX installation, so if you need to backup anything, do it before the above commands. That said, the installer has all the examples you need to get things working and I will be more than happy to help should you have any questions.
As for the
examples
directory, most are setup so that you only need to change theserver_name
directive. The only other thing you may need to modify is thefastcgi_pass
directive since you’re using sockets instead of TCP, or you can modify:and change
listen
to use127.0.0.1:9000
and restartphp-fpm
and the example I provided will work without any changes other than those for your domain.Thank you Does your compile include naxsi?
@stephgiguere
Ideally, if your database is more than a few MB’s in size, you want to use MySQL’s CLI interface to do a restore. A web-based interface, such as phpMyAdmin or Adminer should be able to handle it, though it’s not the best tool for the job.
That being said, if you want to use a web-based interface to do the restore, you’ll need to modify one more variable, and that’d be
client_max_body_size 50m;
, which can be found in:You’ll need to change the current
50m
to match that of yourphp.ini
, or change them all to a value a little over, such as64m
. You’d then want to reload NGINX using:If you want to do this using MySQL’s CLI, you’d use:
Where
dbuser
is the database username,-p
will prompt you for the password,dbname
is the name of the database, anddb.sql
is the SQL dump file that you created.To run that command, you’d login as
root
using SSH, or yoursudo
user. You don’t need to actually enter the MySQL CLI, just change the placeholders and run the command as-is.