Changes

From Amahi Wiki
Jump to: navigation, search
As [[Open_Terminal_as_root|root user]], perform the following steps:
* Build directory structure
<pre> mkdir -p /var/hda/web-apps/appname mkdir -p /var/hda/web-apps/appname/html mkdir -p /var/hda/web-apps/appname/logs chown -R apache:users /var/hda/web-apps/appname chown -R apache:users /var/hda/web-apps/appname/html touch /var/hda/web-apps/appname/logs/access_log touch /var/hda/web-apps/appname/logs/error_log chown -R /var/hda/web-apps/appname/logs/access_log chown -R /var/hda/web-apps/appname/logs/error_log</pre>
* Create Apache configuration file (9999 can be changed to any number, but recommend keep it above 2000 to be safe)
<pre> vi /etc/httpd/conf.d/9999-appname.conf</pre>
::Insert the text below (remember to change all occurrences of appname accordingly and the domain name amahi.net to match yours if needed)
<pre><VirtualHost *:80>
</VirtualHost></pre>
::Change permissions and restart Apache
<pre> chown apache:users /etc/httpd/conf.d/9999-appname.conf service httpd restart</pre>
* Update Amahi 7 database settings<br />
<br />
::To do a quick check, you can do the following for each table:
<pre> echo "select max(id) from dns_aliases" | mysql -uroot -phda hda_production</pre><pre> echo "select max(id) from webapps" | mysql -uroot -phda hda_production</pre>
::Once you have chosen the id number, execute the following
<pre> echo "INSERT INTO `dns_aliases` (`id`, `name`, `address`) VALUES(99, 'appname', '')" | mysql -uroot -phda hda_production</pre><pre> echo "INSERT INTO `webapps` (`id`, `name`, `path`, `kind`, `aliases`, `fname`, `deletable`, `login_required`, `dns_alias_id`, `custom_options`, `created_at`, `updated_at`) VALUES(99, 'appname', '/var/hda/web-apps/appname', '', '', '9999-appname.conf', 0, 0, 99, NULL, '2013-11-17 12:00:00', '2013-11-17 12:00:00')" | mysql -uroot -phda hda_production</pre>
* Create a test file
<pre> vi /var/hda/web-apps/appname/html/index.html</pre>
::Insert the text below
<pre><!DOCTYPE html>
</html></pre>
::Set the correct permissions on the file
<pre> chown apache:users /var/hda/web-apps/appname/html/index.html</pre>
* Test your new web app by entering <b><nowiki>http://appname</nowiki></b> in your browser. If all goes well, you should see the test page.<br />
<br />
12,424

edits