lundi 30 mai 2016

web admin noob - broke local webserver while trying to install jenkins

I just broke my local development web server while trying to install jenkins. Jenkins works. But other sites that I have built and used to access on my web server do not work. I was following this article: http://ift.tt/12RGpBT

After following the main section to download and install jenkins, i ran the steps in the section "Setting up an Apache Proxy for port 80 -> 8080". That's when I managed to break apache.

Here's the history of what I ran:

me@mydevbox:~$ sudo apt-get install jenkins
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-image-4.2.0-34-generic linux-image-extra-4.2.0-34-generic
  python-support
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  daemon
The following NEW packages will be installed:
  daemon jenkins
0 upgraded, 2 newly installed, 0 to remove and 8 not upgraded.
Need to get 64.0 MB of archives.
After this operation, 65.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://ift.tt/x7aQTN wily/universe daemon amd64 0.6.4-1 [98.2 kB]
Get:2 http://ift.tt/1Q2ZIly binary/ jenkins 1.651.2 [63.9 MB]
Fetched 64.0 MB in 6s (9,372 kB/s)                                             
Selecting previously unselected package daemon.
(Reading database ... 433471 files and directories currently installed.)
Preparing to unpack .../daemon_0.6.4-1_amd64.deb ...
Unpacking daemon (0.6.4-1) ...
Selecting previously unselected package jenkins.
Preparing to unpack .../jenkins_1.651.2_all.deb ...
Unpacking jenkins (1.651.2) ...
Processing triggers for man-db (2.7.4-1) ...
Processing triggers for systemd (225-1ubuntu9) ...
Processing triggers for ureadahead (0.100.0-19) ...
Setting up daemon (0.6.4-1) ...
Setting up jenkins (1.651.2) ...
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
[ ok ] Starting jenkins (via systemctl): jenkins.service.
ln: failed to create symbolic link ‘/run/openrc/started/jenkins’: No such file or directory
Processing triggers for systemd (225-1ubuntu9) ...
Processing triggers for ureadahead (0.100.0-19) ...

me@mydevbox:~$ sudo /etc/init.d/jenkins start
[ ok ] Starting jenkins (via systemctl): jenkins.service.
me@mydevbox:~$ sudo vim /etc/default/jenkins 
me@mydevbox:~$ /etc/init.d/jenkins restart
[ ok ] Restarting jenkins (via systemctl): jenkins.service.
me@mydevbox:~$ 

This is what I've specified for the HTTP port in the jenkins config file:

# port for HTTP connector (default 8080; disable with -1)
HTTP_PORT=8080

After that, I ran this:

me@mydevbox:~$ sudo a2enmod proxy
Enabling module proxy.
To activate the new configuration, you need to run:
  service apache2 restart
me@mydevbox:~$ sudo a2enmod proxy_http
Considering dependency proxy for proxy_http:
Module proxy already enabled
Enabling module proxy_http.
To activate the new configuration, you need to run:
  service apache2 restart
me@mydevbox:~$ service apache2 restart
me@mydevbox:~$ sudo a2dissite default
ERROR: Site default does not exist!
me@mydevbox:~$ sudo a2dissite 000-default
Site 000-default disabled.
To activate the new configuration, you need to run:
  service apache2 reload
 me@mydevbox:~$ service apache2 reload

And then I created a jenkins.conf file in /etc/apache2/sites-available/ That file looks like this:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName ci.company.com
    ServerAlias ci
    ProxyRequests Off
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>
    ProxyPreserveHost on
    ProxyPass / http://localhost:8080/ nocanon
    AllowEncodedSlashes NoDecode
</VirtualHost>

At this point, when I try to run:

http://localhost:8080/

That launches jenkins.

But I no longer can run my other sites which i launched like this:

localhost/mytestapp

The error I get is:

HTTP ERROR 404

Problem accessing /mytestapp/. Reason:

Not Found

Prior to attempting Jenkins install, I just installed apache2 and left all defaults. I would just create folders under /var/www/html and they would "just magically" appear in my browser.

Sorry for the trouble. But any help would be appreciated.

EDIT 1

I think my problem is related to this:

 me@mydevbox:~$ sudo a2dissite 000-default
 Site 000-default disabled.

I never noticed that in the output before. When I checked that file, it looks like that was the original conf I had.

Here's what I have in the sites-available folder:

me@mydev:/etc/apache2/sites-available$ ls -lah
total 24K
drwxr-xr-x 2 root root 4.0K May 30 11:06 .
drwxr-xr-x 8 root root 4.0K Apr 19 15:18 ..
-rw-r--r-- 1 root root 1.5K Apr 19 15:30 000-default.conf
-rw-r--r-- 1 root root 6.3K Jan  7  2014 default-ssl.conf
-rw-r--r-- 1 root root  282 May 30 11:06 jenkins.conf
me@mydev:/etc/apache2/sites-available$ 

So I guess I need a way to re-enable 000-default.conf and just add an entry for jenkins to use port 8080 or something like that. Googling for examples but in the mean time, if you have any suggestions, I'd appreciate them.

Thanks.




Aucun commentaire:

Enregistrer un commentaire