Where do I install the Slim framework on my ubuntu ec2 server?

蹲街弑〆低调 提交于 2019-12-12 06:43:46

问题


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:

  1. Connect to your Ubuntu instance using SSH.

  2. Navigate to var/www

  3. Install Composer (follow this link).

  4. Install Slim from Composer:

    composer require slim/slim "^3.0"
    
  5. Create a new project with Slim or just use the default one.

  6. Create a local file index.php with the default code and then upload it to the Slim directory in var/www/MyProject

  7. 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]
    
  8. Navigate to your conf file of Apache by typing this command:

    sudoe nano /etc/apache2/apache2.conf
    
  9. Find the var/www directory and change

    AllowOverride none
    

    to

    AllowOverride All
    

    and then save the file.

  10. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!