[aur-dev] Difficulties setting up local aurweb server
Hi, I tried to setup an nginx server locally for testing aurweb, but I encountered several difficulties. I wanted to start with a clean setup, so first, I deleted the aur user in my system and database and the AUR database in MySQL, that were still lingering around from earlier development (using Apache). Then I installed nginx and made these changes to /etc/nginx/nginx.conf: server { listen 8888; server_name localhost; location / { root /srv/http/aurweb/web/html; index index.html index.htm; } location ~ .* { rewrite ^/(.*)$ /index.php/$1 last; } […] I want to use port 8888, as I still run Apache on port 80 (and Tomcat on 8080). When using the default configuration, so with root pointing to the nginx directory and without the location rewriting, the default welcome page appears when heading to localhost:8888. I copied conf/config.proto to conf/config and adjusted the configuration. A copy is at http://pastebin.com/D1XbnJK1 (and yes, the database password is correct). I created a new MySQL database AUR and user aur and imported the schema according to INSTALL, step 4. Everything went fine. Awful phpmyadmin showed me the newly created database. I added a new user to my system and initialized the Git repo. Also did step 7 (installed git-auth wrapper script). Then I stumbled upon the necessity of using OpenSSH 6.9: it's not in [core] and even openssh-git in the AUR let me build a version 6.8something. Oh well, I don't need an sshd just to tinker with the web interface, the dummy data will be enough, was my assumption. BTW, copying the instructions to generate and load the test data from an earlier version of INSTALL would be helpful (I've still a copy around, so I can create a patch, if needed). However, I went again to localhost:8888 but got a 500 error. When commenting out the rewrite part, I got a 403 Forbidden. I already looked in the logs, but I can only see an access.log that shows me my visits. Any clue of what I did wrong is greatly appreciated. Thanks, Marcel
On Mon, 15 Jun 2015 at 22:42:40, Marcel Korpel wrote:
Hi,
I tried to setup an nginx server locally for testing aurweb, but I encountered several difficulties.
I wanted to start with a clean setup, so first, I deleted the aur user in my system and database and the AUR database in MySQL, that were still lingering around from earlier development (using Apache). Then I installed nginx and made these changes to /etc/nginx/nginx.conf:
server { listen 8888; server_name localhost;
location / { root /srv/http/aurweb/web/html; index index.html index.htm; }
You need another location block here to handle PHP files. The following should work when using php-fpm (modulo paths, of course): location ~ ^/[^/]+\.php($|/) { fastcgi_pass unix:/var/run/php-fpm/aurweb-fpm.sock; fastcgi_index index.php; fastcgi_split_path_info ^(/[^/]+\.php)(/.*)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; include fastcgi_params; } Of course, you also need to setup php-fpm accordingly (basically, create /etc/php/fpm.d/aurweb.conf and configure php-fpm to use the socket from above).
location ~ .* { rewrite ^/(.*)$ /index.php/$1 last; } […]
[...] Then I stumbled upon the necessity of using OpenSSH 6.9: it's not in [core] and even openssh-git in the AUR let me build a version 6.8something. Oh well, I don't need an sshd just to tinker with the web interface, the dummy data will be enough, was my assumption. BTW, copying the instructions to generate and load the test data from an earlier version of INSTALL would be helpful (I've still a copy around, so I can create a patch, if needed). [...]
You can use openssh-aur from the AUR [1] in the meantime. [1] https://aur.archlinux.org/packages/openssh-aur/
* Lukas Fleischer <lfleischer@archlinux.org> (Mon, 15 Jun 2015 22:49:04 +0200):
You need another location block here to handle PHP files. The following should work when using php-fpm (modulo paths, of course):
location ~ ^/[^/]+\.php($|/) { fastcgi_pass unix:/var/run/php-fpm/aurweb-fpm.sock; fastcgi_index index.php; fastcgi_split_path_info ^(/[^/]+\.php)(/.*)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; include fastcgi_params; }
Of course, you also need to setup php-fpm accordingly (basically, create /etc/php/fpm.d/aurweb.conf and configure php-fpm to use the socket from above).
I couldn't get it to work more or less with /etc/php/fpm.d/aurweb.conf and /var/run/php-fpm/aurweb-fpm.sock, respectively (I get the errors in [1]), when using www.conf and php-fpm.sock, I got it working, more or less: I can open HTML files and they are correctly served by nginx. But now I get a 404 when trying to access a (simple) PHP script on localhost:8888 and the "Primary script unknown" message in my log.
You can use openssh-aur from the AUR [1] in the meantime.
Ah, that's what I needed. But do I really need to run an SSH daemon when experimenting with the web interface? [1] http://pastebin.com/rBR3VC79
On Mon, 15 Jun 2015 at 23:32:12, Marcel Korpel wrote:
[...] But now I get a 404 when trying to access a (simple) PHP script on localhost:8888 and the "Primary script unknown" message in my log.
Move the root and index directives out of the location block (directly under the server block).
You can use openssh-aur from the AUR [1] in the meantime.
Ah, that's what I needed. But do I really need to run an SSH daemon when experimenting with the web interface?
No, it is only needed if you want to test changes in the git-interface scripts.
* Lukas Fleischer <lfleischer@archlinux.org> (Tue, 16 Jun 2015 07:11:44 +0200):
Move the root and index directives out of the location block (directly under the server block).
Ah, now I made progress. I can visit the homepage correctly, it only complains that it cannot make a database connection, although my server is running and username and password are correct. Please have a look at my conf/config [1]. I also disabled maintenance mode, but that didn't matter. Also, when going to /packages/, I get a 404 and the log says that the server is looking for /packages/index.php, so there's clearly something wrong with URL rewriting. I uploaded my current nginx.conf at [2]. Please have a look at this again, that would be greatly appreciated! [1] http://pastebin.com/D1XbnJK1 [2] http://pastebin.com/Z9ay8Pc8
* Marcel Korpel <marcel.korpel@gmail.com> (Tue, 16 Jun 2015 11:55:36 +0200):
Also, when going to /packages/, I get a 404 and the log says that the server is looking for /packages/index.php, so there's clearly something wrong with URL rewriting. I uploaded my current nginx.conf at [2].
About this part: one way or another I had that location block in my nginx.conf, I replaced it with the one in INSTALL, but now I get an error about "rewrite or internal redirection cycle", as it wants to access an infinite amount of /index.php/index.php/…
On Tue, 16 Jun 2015 at 13:32:40, Marcel Korpel wrote:
* Marcel Korpel <marcel.korpel@gmail.com> (Tue, 16 Jun 2015 11:55:36 +0200):
Also, when going to /packages/, I get a 404 and the log says that the server is looking for /packages/index.php, so there's clearly something wrong with URL rewriting. I uploaded my current nginx.conf at [2].
About this part: one way or another I had that location block in my nginx.conf, I replaced it with the one in INSTALL, but now I get an error about "rewrite or internal redirection cycle", as it wants to access an infinite amount of /index.php/index.php/…
You need to move the block that handles .php URIs above the "match-anything" rule, check [1] for details. [1] http://nginx.org/en/docs/http/ngx_http_core_module.html#location
* Lukas Fleischer <lfleischer@archlinux.org> (Tue, 16 Jun 2015 14:05:59 +0200):
You need to move the block that handles .php URIs above the "match-anything" rule, check [1] for details.
Yes, got it! Now aurweb displays fine and I also got the database connection working after entering another password. Now there's a strange thing with the dummy data: after removing CategoryID, of which I'll send in a patch soon, I get an error viewing the submitter, maintainer and last packager on a package page. Above a user name, this appears: Notice: Undefined index: AURSID in /srv/http/aurweb/web/lib/aur.inc.php on line 189 This only appears when not logged in (but not in live aurweb). Does there need to be a check for that cookie being present? Best, Marcel
On 15/06, Marcel Korpel wrote:
However, I went again to localhost:8888 but got a 500 error. When commenting out the rewrite part, I got a 403 Forbidden. I already looked in the logs, but I can only see an access.log that shows me my visits.
The 403 error is likely due to maintenance mode being turned on. -- Sincerely, Johannes Löthberg PGP Key ID: 0x50FB9B273A9D0BB5 https://theos.kyriasis.com/~kyrias/
* Johannes Löthberg <johannes@kyriasis.com> (Mon, 15 Jun 2015 23:02:58 +0200):
The 403 error is likely due to maintenance mode being turned on.
Maintenance mode? Well, at least that was not the issue, it was 'directory index of "/srv/http/aurweb/web/html/" is forbidden'. Marcel
Hi Marcel, On 06/15/2015 10:33 PM, Marcel Korpel wrote:
* Johannes Löthberg <johannes@kyriasis.com> (Mon, 15 Jun 2015 23:02:58 +0200):
The 403 error is likely due to maintenance mode being turned on.
Maintenance mode? Well, at least that was not the issue, it was 'directory index of "/srv/http/aurweb/web/html/" is forbidden'.
Marcel
I had to put a root to nginx pointing to /srv/http/aurweb/web/http. Now the best approach but now it's working so I leave it as is. It's a VM anyway so not really an issue. PS: I also use NFS sharing between host and guest to hold the aurweb to the host (and make any changes there) and host the nginx, mysql etc to the guest.
participants (4)
-
Johannes Löthberg
-
Leonidas Spyropoulos
-
Lukas Fleischer
-
Marcel Korpel