<p>Craft install (LAMP)</p>

<p><strong><em>LAMP Install</em></strong></p>

<p><strong>Step 1: Install Apache and Allow in Firewall</strong></p>

<p>apt-get update<br>
apt-get install apache2</p>

<p><strong>Set Global ServerName to Suppress Syntax Warnings</strong></p>

<p>apache2ctl configtest<br>
nano /etc/apache2/apache2.conf<br>
<strong><em>ADD:</em></strong> ServerName 'server_domain_or_IP'<br>
apache2ctl configtest<br>
systemctl restart apache2</p>

<p><strong>Adjust the Firewall to Allow Web Traffic</strong></p>

<p>ufw app list<br>
ufw app info "Apache Full"<br>
ufw allow in "Apache Full"<br>
<strong><em>Test:</em></strong> <a href="http://your_server_IP_address" rel="nofollow noreferrer">http://your_server_IP_address</a></p>

<p><strong>Step 2: Install MySQL</strong></p>

<p>apt-get install mysql-server<br>
mysql_secure_installation</p>

<p><strong>Step 3: Install PHP</strong></p>

<p>apt-get install php libapache2-mod-php php-mcrypt php-mysql<br>
nano /etc/apache2/mods-enabled/dir.conf<br>
Move the index.php file to the first position after the "DirectoryIndex" specification<br>
systemctl restart apache2<br>
systemctl status apache2</p>

<p><strong>Install PHP Modules</strong></p>

<p>apt-get install php-mbstring php7.0-mbstring php-gettext libapache2-mod-php7.0<br>
phpenmod mcrypt<br>
phpenmod mbstring<br>
systemctl restart apache2<br>
apt-get install curl<br>
apt-get install imagemagick<br>
apt-get install</p>

<p><strong>Step 4: Test PHP Processing on your Web Server</strong></p>

<p>nano /var/www/html/info.php<br>
<br>
<strong><em>Test:</em></strong> <a href="http://your_server_IP_address/info.php" rel="nofollow noreferrer">http://your_server_IP_address/info.php</a><br>
rm /var/www/html/info.php</p>

<p><strong><em>Craft Install</em></strong></p>

<p>scp -r /Users/Purvis/Desktop/Website/WebserverInfo/CraftCMS/public/.htaccess root@192.168.10.39:/var/www/html/public<br>
scp -r /Users/Purvis/Desktop/Website/WebserverInfo/CraftCMS/public/index.php root@192.168.10.39:/var/www/html/public<br>
scp -r /Users/Purvis/Desktop/Website/WebserverInfo/CraftCMS/public/robots.txt root@192.168.10.39:/var/www/html/public<br>
scp -r /Users/Purvis/Desktop/Website/WebserverInfo/CraftCMS/craft root@192.168.10.39:/var/www/html/</p>

<p>mv htaccess .htaccess</p>

<p>mysql -uroot -p</p>

<p>CREATE DATABASE craftdb;<br>
CREATE USER 'craftdba'@'localhost' IDENTIFIED BY 'your_password';<br>
GRANT ALL PRIVILEGES ON 'craftdb'.* TO 'craftdba'@'localhost';<br>
FLUSH PRIVILEGES;<br>
exit</p>

<p>nano /var/www/html/craft/config/db.php</p>

<p>Database Details<br>
Database Name: craftdb<br>
DataBase Username: craftdba<br>
Database Password: your_password</p>

<p>chown -R www-data:www-data /var/www/html/craft<br>
chmod -R 775 /var/www/html/*</p>

<p>service apache2 restart<br>
192.168.10.39/public/index.php/admin/install</p>

<p>That was what was needed to finally get Craft to work!</p>

CC BY-SA 3.0
2017-03-08T01:10:52.520Z
2017-03-08T01:10:52.520Z
Michael Purvis
<p>First, I can positively confirm I have Craft running on two not hosted, local servers - one a Ubuntu 14.04 (well, Mint) installation, and one a Windows box using Uniserver.  Not sure quite what you're reading - and I think you might be misinterpreting what you're reading - but just about every dev around here will have a local install they work on, one way another - e.g. using MAMP, or something like Laravel Valet, Homestead, Vagrant etc.  (I'd be willing to bet MAMP is the most popular way).</p>

<p>In both cases I followed: <a href="https://craftcms.com/docs/installing" rel="nofollow noreferrer">https://craftcms.com/docs/installing</a> - if you follow that <em>precisely</em>, it will help.</p>

<p>Apache is a relatively finicky little beast to configure, particularly with respect to Virtual Hosts...but as to why you're getting that particular Not Found error, that's hard to say without seeing your installation layout, and your virtual host definition at the minimum.  </p>

<p>I'd start by looking in your apache logs (immediately after a restart and one attempt to access the adming at <code>/admin</code>) to make sure your virtual host definition is correct at least, and not raising errors.  Check both the <code>access.log</code> and <code>error.log</code> for clues.</p>

<p>Some basic stuff:</p>

<p>My sites live at <code>/var/www/vhosts/sitename/</code></p>

<p>under this folder I have:</p>

<p><code>craft</code> - where the Craft install lives (so under this you have <code>app</code>,<code>config</code> etc)</p>

<p><code>public_html</code> - under this is where index.php lives</p>

<p>A very basic vhost setup might look like:</p>

<pre><code>&lt;VirtualHost *:80&gt;

    ServerName dev.whatever.net.au
    ServerAlias whatever
    ServerAdmin user@whatever.com.au

    DocumentRoot /var/www/vhosts/whatever/public_html

    ErrorLog ${APACHE_LOG_DIR}/whatever.error.log
    CustomLog ${APACHE_LOG_DIR}/whatever.access.log combined

    &lt;Directory "/var/www/vhosts/whatever"&gt;

        Options Indexes Includes FollowSymLinks

    &lt;/Directory&gt;

&lt;/VirtualHost&gt;
</code></pre>

CC BY-SA 3.0
2017-02-21T19:53:55.983Z
Thank you Jeremy for the confirmation! I was really about to start to loose my mind with this program. I will start with your suggestion today and will update this with my findings.
Michael Purvis
CC BY-SA 3.0
2017-02-21T04:34:32.490Z
2017-02-21T04:34:32.490Z
Jeremy Daalder
<p>Thank you to anyone that can provide real assistance to my problem with Craft and installing it on a local server. Your help and assistance are truly appreciated!! :-)</p>

<p>I need 100% confirmation that Craft can be installed on a server that is NOT a hosted server!! Everything I read for assistance with my problem all talk about their instance of Craft that is on a hosted server....not a single person (so far) has installed and configured Craft on their local server, only on a hosted server.</p>

<p>SO.....does Craft need be installed on a hosted server or can it actually be installed on a local server inside my network?
If Craft can be installed locally, someone who has installed Craft on a local server, please tell me why I get the following when trying to access 192.168.10.101/admin (example IP address, though here locally I am using my IP address before making the DNS change over to point to my domain):</p>

<blockquote>
  <p>Not Found</p>
  
  <p>The requested URL /admin was not found on this server.
  Apache/2.4.18 (Ubuntu) Server at 192.168.10.11 Port 80</p>
</blockquote>

<p>Yes, I have updated the virtual host within the sites-available folder in apache, error still the same.
Now before anyone says anything about if I have done the following, Yes, I have, error is still present:</p>

<pre><code>Did you rename htaccess to .htaccess? &lt;-- Yes
----------------------------------------------
http://192.168.10.11/index.php?p=admin  &lt;--Nothing happens;same error
http://192.168.10.11/index.php/admin    &lt;--Nothing happens;same error
----------------------------------------------
'craft' folder is sitting in at 'var/www' and index.php at /var/www/html

Question: Do I need to create new folder(s) called 'public_html'? 
If so, only under /html?

OR does /var/www/html/AllCraftPublicFilesLivesUnderHTML work for apache?
-----------------------------------------------
$craftPath = './craft'; AS WELL AS $craftPath = '../craft'; &lt;-- No Change
</code></pre>

<p>This is now my third build for this program and I am getting sick of hearing "It should just work" as it clearly does not 'just work'. I am more than happy to show you anything you may want to view, though this is my thrid build, so I might not have it right away, but will!</p>

<p><strong>Updated 03/02/2017:</strong></p>

<p>Followed the answer suggested below and started completely fresh. This time I decided to follow the suggestion of Craft, and went with a LEMP configuration -- see below for all environment details, everything should be included for your review, so a smarter Admin should be able to see what I am doing wrong or forgot; let me know if I did miss something and I will get it up here. This is a brand new VM and only myself has access to this VM...never been introduced to my network yet.</p>

<blockquote>
  <p>OracleBox Virtualization software<br>
  Ubuntu 16.10 server iso<br>
     'PlymouthWeb' is the name of the VM<br>
     Standard install<br>
          openssh server installed<br>
          manage package selection<br>
      ssh root login enabled<br>
      Ran apt-get update<br>
      Ran apt-get upgrade - 16.10 ‘yakkety’<br>
      Ran apt-get dist-upgrade<br>
      Ran apt-get auto remove </p>
</blockquote>

<p>Nginx install (mediatemple.net/community/products/developer/204405534/install-nginx-on-ubuntu; tecmint.com/install-nginx-mysql-php-lemp-in-ubuntu-16-10-ubuntu-16-04/)</p>

<p>MariaDB install (websiteforstudents.com/students-tutorial-install-mariadb-ubuntu-16-10/; tecmint.com/install-nginx-mysql-php-lemp-in-ubuntu-16-10-ubuntu-16-04/)</p>

<p>PHP (tecmint.com/install-nginx-mysql-php-lemp-in-ubuntu-16-10-ubuntu-16-04/)</p>

<p>db.php
    

<pre><code>return array(
    ' =&gt; array(
        'server' =&gt; 'localhost',
        'user' =&gt; 'root',
        'password' =&gt; 'plymouth1',
        'database' =&gt; 'plymouth',
        'tablePrefix' =&gt; 'craft',
    ),
    '192.168.10.19' =&gt; array(
        'server' =&gt; 'localhost',
        'user' =&gt; 'root',
        'password' =&gt; 'root',
        'database' =&gt; 'plymouth',
    ),
);
</code></pre>

<p>general.php</p>

<pre><code>&lt;?php

return array(
    ' =&gt; array(
        'omitScriptNameInUrls' =&gt; true,
        'generateTransformsBeforePageLoad' =&gt; true,
        'environmentVariables' =&gt; array(
            'basePath' =&gt; '/var/www/www.plymouthinc.com/public',
            'baseUrl'  =&gt; 'http://plymouthinc.com/',
        )
    ),
    '.local' =&gt; array(
        'devMode' =&gt; 'true',
        'generateTransformsBeforePageLoad' =&gt; true,
        'environmentVariables' =&gt; array(
            'basePath' =&gt; '/var/www/www.plymouthinc.com/public',
            'baseUrl'  =&gt; 'http://plymouth.local/',
        )
    ),
);
</code></pre>

<p>Virtual Host - /etc/nginx/sites-available/www.plymouthinc.com   </p>

<pre><code>server {

listen   80;
server_name  www.plymouthinc.com;
rewrite ^/(. http://plymouthinc.com/$1 permanent;
}

server {

listen   80;
server_name www.plymouthinc.com;

access_log /var/www/www.plymouthinc.com/logs/access.log;
error_log /var/www/www.plymouthinc.com/logs/error.log;

location / {

root   /var/www/www.plymouthinc.com/public/;
index  index.html;
}
}
</code></pre>

<p>index.php - 
    /var/www/www.plymouthinc.com/public
    

<pre><code>// Path to your craft/ folder
$craftPath = '../craft';

// Do not edit below this line
$path = rtrim($craftPath, '/').'/app/index.php';

if (!is_file($path))
{
if (function_exists('http_response_code'))
{
    http_response_code(503);
}

exit('Could not find your craft/ folder. Please ensure that &lt;strong&gt;&lt;code&gt;$craftPath&lt;/code&gt;&lt;/strong&gt; is set correctly in '.__FILE__);
}

require_once $path;
</code></pre>

<p>Now when I go to 192.168.10.19/admin, I get a <em>404 Not Found</em>; please review my notes here and let me know what I missed to get this to work for me locally. At this point in time, I need very specific examples in any answers provided please (like the answer below, he provided excellent details in his reply). I ask for specifics as all documentation I have read in the wilds of the internet, everyone provides </p>

<p>Yes, I am using the VM's ip address on my mac when attempting to access my Craft site in a browser; all the server name locations where the IP address (nothing worked), changed to the soon to be domain name, and still nothing works.</p>

<p>I have been working on this project for three weeks and have been stuck trying to get the Craft Installer to run so I can finish building this website.</p>

<p>If you truly have been successful in the past with Craft, please help me out..to include sending emails/screenshots back and forth, to possibly even jump on a screen share if you can confirm you have been successful with installing and configuring craft...I really don't need another person to respond with "It should just work, especially if you follow the install guide".</p>

<p>Thank you,<br>
Frustrated System Administrator</p>

CC BY-SA 3.0
2017-03-03T05:49:26.567Z
Removing Craft from the equation for a moment, have you been able to get a simple "Hello world" test running? Even just a plain HTML file that you can view in your browser?
Lindsey D
CC BY-SA 3.0
2017-03-03T16:21:05.760Z
Unless you're experienced with setting up Apache, this doesn't look like you've chosen the easiest setup. Have you tried MAMP or WAMP instead?
Clive Portman
CC BY-SA 3.0
2017-03-06T19:13:08.207Z
'Lindsey D' -- thank you and yes. I can get both index.php (non craft) and index.html to load in a browser prior to starting the craft install.
Michael Purvis
CC BY-SA 3.0
2017-03-06T19:14:50.757Z
'Clive Portman' -- thank you and no. I have set up a few LAMP servers in the past with no issues, especially dekiwiki (if you're familiar with that program).
Michael Purvis
<installation><nginx>
Can I use an IP address instead of a FQDN?
# Can I use an IP address instead of a FQDN?

(Asked by: username_0 on 2017-02-21)

Thank you to anyone that can provide real assistance to my problem with Craft and installing it on a local server. Your help and assistance are truly appreciated!! :-)
I need 100% confirmation that Craft can be installed on a server that is NOT a hosted server!! Everything I read for assistance with my problem all talk about their instance of Craft that is on a hosted server....not a single person (so far) has installed and configured Craft on their local server, only on a hosted server.
SO.....does Craft need be installed on a hosted server or can it actually be installed on a local server inside my network?
If Craft can be installed locally, someone who has installed Craft on a local server, please tell me why I get the following when trying to access 192.168.10.101/admin (example IP address, though here locally I am using my IP address before making the DNS change over to point to my domain):

Not Found
The requested URL /admin was not found on this server.
  Apache/2.4.18 (Ubuntu) Server at 192.168.10.11 Port 80

Yes, I have updated the virtual host within the sites-available folder in apache, error still the same.
Now before anyone says anything about if I have done the following, Yes, I have, error is still present:
Did you rename htaccess to .htaccess? <-- Yes
----------------------------------------------
http://192.168.10.11/index.php?p=admin  <--Nothing happens;same error
http://192.168.10.11/index.php/admin    <--Nothing happens;same error
----------------------------------------------
'craft' folder is sitting in at 'var/www' and index.php at /var/www/html

Question: Do I need to create new folder(s) called 'public_html'? 
If so, only under /html?

OR does /var/www/html/AllCraftPublicFilesLivesUnderHTML work for apache?
-----------------------------------------------
$craftPath = './craft'; AS WELL AS $craftPath = '../craft'; <-- No Change

This is now my third build for this program and I am getting sick of hearing "It should just work" as it clearly does not 'just work'. I am more than happy to show you anything you may want to view, though this is my thrid build, so I might not have it right away, but will!
Updated 03/02/2017:
Followed the answer suggested below and started completely fresh. This time I decided to follow the suggestion of Craft, and went with a LEMP configuration -- see below for all environment details, everything should be included for your review, so a smarter Admin should be able to see what I am doing wrong or forgot; let me know if I did miss something and I will get it up here. This is a brand new VM and only myself has access to this VM...never been introduced to my network yet.

OracleBox Virtualization software
  Ubuntu 16.10 server iso
     'PlymouthWeb' is the name of the VM
     Standard install
          openssh server installed
          manage package selection
      ssh root login enabled
      Ran apt-get update
      Ran apt-get upgrade - 16.10 ‘yakkety’
      Ran apt-get dist-upgrade
      Ran apt-get auto remove 

Nginx install (mediatemple.net/community/products/developer/204405534/install-nginx-on-ubuntu; tecmint.com/install-nginx-mysql-php-lemp-in-ubuntu-16-10-ubuntu-16-04/)
MariaDB install (websiteforstudents.com/students-tutorial-install-mariadb-ubuntu-16-10/; tecmint.com/install-nginx-mysql-php-lemp-in-ubuntu-16-10-ubuntu-16-04/)
PHP (tecmint.com/install-nginx-mysql-php-lemp-in-ubuntu-16-10-ubuntu-16-04/)
db.php
    

return array(
    ' => array(
        'server' => 'localhost',
        'user' => 'root',
        'password' => 'plymouth1',
        'database' => 'plymouth',
        'tablePrefix' => 'craft',
    ),
    '192.168.10.19' => array(
        'server' => 'localhost',
        'user' => 'root',
        'password' => 'root',
        'database' => 'plymouth',
    ),
);

general.php
 array(
        'omitScriptNameInUrls' => true,
        'generateTransformsBeforePageLoad' => true,
        'environmentVariables' => array(
            'basePath' => '/var/www/www.plymouthinc.com/public',
            'baseUrl'  => 'http://plymouthinc.com/',
        )
    ),
    '.local' => array(
        'devMode' => 'true',
        'generateTransformsBeforePageLoad' => true,
        'environmentVariables' => array(
            'basePath' => '/var/www/www.plymouthinc.com/public',
            'baseUrl'  => 'http://plymouth.local/',
        )
    ),
);

Virtual Host - /etc/nginx/sites-available/www.plymouthinc.com   
server {

listen   80;
server_name  www.plymouthinc.com;
rewrite ^/(. http://plymouthinc.com/$1 permanent;
}

server {

listen   80;
server_name www.plymouthinc.com;

access_log /var/www/www.plymouthinc.com/logs/access.log;
error_log /var/www/www.plymouthinc.com/logs/error.log;

location / {

root   /var/www/www.plymouthinc.com/public/;
index  index.html;
}
}

index.php - 
    /var/www/www.plymouthinc.com/public
    

// Path to your craft/ folder
$craftPath = '../craft';

// Do not edit below this line
$path = rtrim($craftPath, '/').'/app/index.php';

if (!is_file($path))
{
if (function_exists('http_response_code'))
{
    http_response_code(503);
}

exit('Could not find your craft/ folder. Please ensure that $craftPath is set correctly in '.__FILE__);
}

require_once $path;

Now when I go to 192.168.10.19/admin, I get a 404 Not Found; please review my notes here and let me know what I missed to get this to work for me locally. At this point in time, I need very specific examples in any answers provided please (like the answer below, he provided excellent details in his reply). I ask for specifics as all documentation I have read in the wilds of the internet, everyone provides 
Yes, I am using the VM's ip address on my mac when attempting to access my Craft site in a browser; all the server name locations where the IP address (nothing worked), changed to the soon to be domain name, and still nothing works.
I have been working on this project for three weeks and have been stuck trying to get the Craft Installer to run so I can finish building this website.
If you truly have been successful in the past with Craft, please help me out..to include sending emails/screenshots back and forth, to possibly even jump on a screen share if you can confirm you have been successful with installing and configuring craft...I really don't need another person to respond with "It should just work, especially if you follow the install guide".
Thank you,
Frustrated System Administrator

**Tags:** installation, nginx
> **Comments:**
> **username_1**: Removing Craft from the equation for a moment, have you been able to get a simple "Hello world" test running? Even just a plain HTML file that you can view in your browser?  
> **username_2**: Unless you're experienced with setting up Apache, this doesn't look like you've chosen the easiest setup. Have you tried MAMP or WAMP instead?  
> **username_0**: 'Lindsey D' -- thank you and yes. I can get both index.php (non craft) and index.html to load in a browser prior to starting the craft install.  
> **username_0**: 'Clive Portman' -- thank you and no. I have set up a few LAMP servers in the past with no issues, especially dekiwiki (if you're familiar with that program).  

---

## 2 answers

### Answer by username_0 on 2017-03-08. Score: 1 | Accepted answer

Craft install (LAMP)

***LAMP Install***

**Step 1: Install Apache and Allow in Firewall**

apt-get update  
apt-get install apache2

**Set Global ServerName to Suppress Syntax Warnings**

apache2ctl configtest  
nano /etc/apache2/apache2.conf  
***ADD:*** ServerName 'server\_domain\_or\_IP'  
apache2ctl configtest  
systemctl restart apache2

**Adjust the Firewall to Allow Web Traffic**

ufw app list  
ufw app info "Apache Full"  
ufw allow in "Apache Full"  
***Test:*** <http://your_server_IP_address>

**Step 2: Install MySQL**

apt-get install mysql-server  
mysql\_secure\_installation

**Step 3: Install PHP**

apt-get install php libapache2-mod-php php-mcrypt php-mysql  
nano /etc/apache2/mods-enabled/dir.conf  
Move the index.php file to the first position after the "DirectoryIndex" specification  
systemctl restart apache2  
systemctl status apache2

**Install PHP Modules**

apt-get install php-mbstring php7.0-mbstring php-gettext libapache2-mod-php7.0  
phpenmod mcrypt  
phpenmod mbstring  
systemctl restart apache2  
apt-get install curl  
apt-get install imagemagick  
apt-get install

**Step 4: Test PHP Processing on your Web Server**

nano /var/www/html/info.php  
  
***Test:*** <http://your_server_IP_address/info.php>  
rm /var/www/html/info.php

***Craft Install***

scp -r /Users/Purvis/Desktop/Website/WebserverInfo/CraftCMS/public/.htaccess root@192.168.10.39:/var/www/html/public  
scp -r /Users/Purvis/Desktop/Website/WebserverInfo/CraftCMS/public/index.php root@192.168.10.39:/var/www/html/public  
scp -r /Users/Purvis/Desktop/Website/WebserverInfo/CraftCMS/public/robots.txt root@192.168.10.39:/var/www/html/public  
scp -r /Users/Purvis/Desktop/Website/WebserverInfo/CraftCMS/craft root@192.168.10.39:/var/www/html/

mv htaccess .htaccess

mysql -uroot -p

CREATE DATABASE craftdb;  
CREATE USER 'craftdba'@'localhost' IDENTIFIED BY 'your\_password';  
GRANT ALL PRIVILEGES ON 'craftdb'.\* TO 'craftdba'@'localhost';  
FLUSH PRIVILEGES;  
exit

nano /var/www/html/craft/config/db.php

Database Details  
Database Name: craftdb  
DataBase Username: craftdba  
Database Password: your\_password

chown -R www-data:www-data /var/www/html/craft  
chmod -R 775 /var/www/html/\*

service apache2 restart  
192.168.10.39/public/index.php/admin/install

That was what was needed to finally get Craft to work!


---

### Answer by username_3 on 2017-02-21. Score: 4

First, I can positively confirm I have Craft running on two not hosted, local servers - one a Ubuntu 14.04 (well, Mint) installation, and one a Windows box using Uniserver.  Not sure quite what you're reading - and I think you might be misinterpreting what you're reading - but just about every dev around here will have a local install they work on, one way another - e.g. using MAMP, or something like Laravel Valet, Homestead, Vagrant etc.  (I'd be willing to bet MAMP is the most popular way).
In both cases I followed: https://craftcms.com/docs/installing - if you follow that precisely, it will help.
Apache is a relatively finicky little beast to configure, particularly with respect to Virtual Hosts...but as to why you're getting that particular Not Found error, that's hard to say without seeing your installation layout, and your virtual host definition at the minimum.  
I'd start by looking in your apache logs (immediately after a restart and one attempt to access the adming at /admin) to make sure your virtual host definition is correct at least, and not raising errors.  Check both the access.log and error.log for clues.
Some basic stuff:
My sites live at /var/www/vhosts/sitename/
under this folder I have:
craft - where the Craft install lives (so under this you have app,config etc)
public_html - under this is where index.php lives
A very basic vhost setup might look like:


    ServerName dev.whatever.net.au
    ServerAlias whatever
    ServerAdmin user@whatever.com.au

    DocumentRoot /var/www/vhosts/whatever/public_html

    ErrorLog ${APACHE_LOG_DIR}/whatever.error.log
    CustomLog ${APACHE_LOG_DIR}/whatever.access.log combined

    

        Options Indexes Includes FollowSymLinks

> **Comments:**
> **username_0**: Thank you Jeremy for the confirmation! I was really about to start to loose my mind with this program. I will start with your suggestion today and will update this with my findings.  

---

