问题
I am using Amazon Web Services to create a ubuntu EC2 server. I installed apache2, php, mysql on it already. Now I need to install Slim, but I'm not sure where. Do I do this in /var/www ?
I have never done this before and I am still not sure what the purpose of Slim is to be honest. I have just been instructed to install Slim on my server, and I just want to know where.
Thank you
edit: See below. I stored it in /var/www/html on my amazon EC2 server
回答1:
To install Slim in your ES2 Ubuntu instance:
Connect to your Ubuntu instance using SSH.
Navigate to var/www
Install Composer (follow this link).
Install Slim from Composer:
composer require slim/slim "^3.0"
Create a new project with Slim or just use the default one.
Create a local file index.php with the default code and then upload it to the Slim directory in var/www/MyProject
Create an .htaccess file in the same directory as index.php containing:
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^ index.php [QSA,L]
Navigate to your conf file of Apache by typing this command:
sudoe nano /etc/apache2/apache2.conf
Find the var/www directory and change
AllowOverride none
to
AllowOverride All
and then save the file.
Restart your Apache service by typing
sudo service apache2 restart
That's all.
I suppose you can access your instance via SSH and get a full control of your Ubuntu instance terminal.
来源:https://stackoverflow.com/questions/36204853/where-do-i-install-the-slim-framework-on-my-ubuntu-ec2-server