Changes

From Amahi Wiki
Jump to: navigation, search
no edit summary
As [[Open_Terminal_as_root|root user]], perform the following steps:
* Build directory structure
<blockquotepre>{{code|mkdir -p /var/hda/web-apps/appname
mkdir -p /var/hda/web-apps/appname/html
mkdir -p /var/hda/web-apps/appname/logs
touch /var/hda/web-apps/appname/logs/error_log
chown root:root /var/hda/web-apps/appname/logs/access_log
chown root:root /var/hda/web-apps/appname/logs/error_log}}</blockquotepre>
* Create Apache configuration file (9999 can be changed to any number, but recommend keep it above 2000 to be safe)
<blockquotepre>{{code|vi /etc/httpd/conf.d/9999-appname.conf}}</blockquotepre>
:Insert the text below (remember to change all occurrences of appname accordingly and the domain name amahi.net to match yours if needed)
<blockquotepre>{{text|<VirtualHost *:80>
ServerName appname
ErrorLog /var/hda/web-apps/appname/logs/error_log
CustomLog /var/hda/web-apps/appname/logs/access_log combined env<nowiki>=</nowiki>!dontlog
</VirtualHost>}}</blockquotepre>
:Change permissions and restart Apache
<blockquotepre>{{code|chown apache:users /etc/httpd/conf.d/9999-appname.confservice httpd restart}}</blockquotepre>
* Update Amahi 7 database settings
**The id field is set to 99 for this example. It can be any number not currently used by Amahi. Recommend you keep it at 99 or greater to be safe.<br />
**Ensure you replace appname accordingly and the date can be changed providing you follow the format. If you changed the .conf file name, ensure it matches as well.
**To do a quick check, you can do the following for each table:
<blockquotepre>{{code|echo "select max(id) from dns_aliases" <nowiki>|</nowiki> mysql -uroot -phda hda_productionecho "select max(id) from webapps" <nowiki>|</nowiki> mysql -uroot -phda hda_production}}</blockquotepre>
:Once you have chosen the id number, execute the following
<blockquotepre>{{code|echo "INSERT INTO dns_aliases (id, name, address) VALUES(99, 'appname', '')" <nowiki>|</nowiki> mysql -uroot -phda hda_productionecho "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')" <nowiki>|</nowiki> mysql -uroot -phda hda_production}}</blockquotepre>
* Create a test file
<blockquotepre>{{code|vi /var/hda/web-apps/appname/html/index.html}}</blockquotepre>
:Insert the text below
<blockquotepre>{{text|<!DOCTYPE html>
<html>
<body>
</body>
</html>}}</blockquotepre>
:Set the correct permissions on the file
<blockquotepre>{{code|chown apache:users /var/hda/web-apps/appname/html/index.html}}</blockquotepre>
* 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. If you have problems, retrace your steps. Ensure you replaced all occurrences of appname accordingly and the id field in both tables match.
As [[Open_Terminal_as_root|root user]], perform the following steps:
* Remove the Apache configuration file
<blockquotepre>{{code|rm -rf /etc/httpd/conf.d/9999-appname.conf}}</blockquotepre>
* Delete the web app directory
<blockquotepre>{{code|rm -rf /var/hda/web-apps/appname}}</blockquotepre>
* Restart Apache
<blockquotepre>{{code|service httpd restart}}</blockquotepre>
* Update Amahi 7 database settings<br />
<blockquotepre>{{code|echo "DELETE FROM `dns_aliases` where id<nowiki>=</nowiki>99" <nowiki>|</nowiki> mysql -uroot -phda hda_productionecho "DELETE FROM `webapps` where id<nowiki>=</nowiki>99" <nowiki>|</nowiki> mysql -uroot -phda hda_production}}</blockquotepre>
:Once complete, the web app should now be completely removed from your system.
Return to [[Amahi_7_installation|Amahi 7 Installation]] page.
12,424

edits