问题描述
我正在使用Amazon Web Services创建ubuntu EC2服务器.我已经安装了apache2,php,mysql.现在,我需要安装Slim,但不确定在哪里.我要在/var/www中这样做吗?
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 ?
我以前从未做过,而且我仍然不确定Slim的目的是什么.我刚刚被指示要在服务器上安装Slim,我只想知道在哪里.
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.
谢谢
请参见下文.我将其存储在Amazon EC2服务器上的/var/www/html中
edit: See below. I stored it in /var/www/html on my amazon EC2 server
推荐答案
要在您的ES2 Ubuntu实例中安装Slim:
To install Slim in your ES2 Ubuntu instance:
-
使用SSH连接到您的Ubuntu实例.
Connect to your Ubuntu instance using SSH.
导航到var/www
Navigate to var/www
安装Composer(关注此链接).
Install Composer (follow this link).
从Composer安装Slim:
Install Slim from Composer:
composer require slim/slim "^3.0"
使用Slim创建一个新项目,或仅使用默认项目.
Create a new project with Slim or just use the default one.
使用默认代码创建本地文件index.php,然后将其上传到var/www/MyProject
Create a local file index.php with the default code and thenupload it to the Slim directory in var/www/MyProject
在与index.php相同的目录中创建一个.htaccess文件,其中包含:
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]
通过键入以下命令导航到Apache的conf文件:
Navigate to your conf file of Apache by typing this command:
sudoe nano /etc/apache2/apache2.conf
找到var/www目录并更改
Find the var/www directory and change
AllowOverride none
到
AllowOverride All
然后保存文件.
通过键入
sudo service apache2 restart
仅此而已.
我想您可以通过SSH访问您的实例并完全控制您的Ubuntu实例终端.
I suppose you can access your instance via SSH and get a full control of your Ubuntu instance terminal.
这篇关于我在ubuntu ec2服务器上的哪里安装Slim框架?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!