0

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

<?php

return array(
    ' => 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 <strong><code>$craftPath</code></strong> 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

4
  • 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?
    – Lindsey D
    Commented Mar 3, 2017 at 5:49
  • 1
    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? Commented Mar 3, 2017 at 16:21
  • '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. Commented Mar 6, 2017 at 19:13
  • '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). Commented Mar 6, 2017 at 19:14

2 Answers 2

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:

<VirtualHost *:80>

    ServerName dev.whatever.net.au
    ServerAlias whatever
    ServerAdmin [email protected]

    DocumentRoot /var/www/vhosts/whatever/public_html

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

    <Directory "/var/www/vhosts/whatever">

        Options Indexes Includes FollowSymLinks

    </Directory>

</VirtualHost>
1
  • 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. Commented Feb 21, 2017 at 19:53
1

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 [email protected]:/var/www/html/public
scp -r /Users/Purvis/Desktop/Website/WebserverInfo/CraftCMS/public/index.php [email protected]:/var/www/html/public
scp -r /Users/Purvis/Desktop/Website/WebserverInfo/CraftCMS/public/robots.txt [email protected]:/var/www/html/public
scp -r /Users/Purvis/Desktop/Website/WebserverInfo/CraftCMS/craft [email protected]:/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!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.