Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure nginx to talk to HHVM #5378

Closed
challenges90 opened this issue May 20, 2015 · 5 comments
Closed

Configure nginx to talk to HHVM #5378

challenges90 opened this issue May 20, 2015 · 5 comments

Comments

@challenges90
Copy link

There's no /etc/nginx/sites-available or /etc/nginx/sites-enabled folder in nginx-1.9.0. So the script: sudo /usr/share/hhvm/install_fastcgi.sh will not work. How to fix it ? Please help me.

@r3wt
Copy link

r3wt commented May 20, 2015

build the server block directly into nginx.conf, inside of your http block

example

     server {
        listen 80;
        server_name www.example.com;
        root /usr/share/nginx/html/;
        index index.php;
        server_tokens off;
        add_header X-Frame-Options SAMEORIGIN;
        add_header X-Content-Type-Options nosniff;
        add_header X-XSS-Protection "1; mode=block";    

        location ~ \.(hh|php)$ {
            try_files $uri = 404;
            location ~ \..*/.*\.php$ {return 404;}
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_keep_conn on;
            fastcgi_pass unix:/var/run/hhvm/hhvm.sock;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
        location ~* .(png|gif|jpg|jpeg|ico|css|js|woff|ttf|otf|woff2|eot)$ {
            include /etc/nginx/mime.types;
            expires max;
        }   
    }

@jwatzman
Copy link
Contributor

Yeah @r3wt has the right idea -- what the script does isn't that complicated if you want to read it and manually apply the changes.

That said, the script ideally would work anyways :) @challenges90 what Linux distribution are you using, and what version of that distro? How did you install nginx -- did you install it with a package manager, or install it by hand?

@challenges90
Copy link
Author

The OS is Ubuntu 14.04 x64. According to http://nginx.org/en/linux_packages.html#mainline, I install nginx like below:

nano /etc/apt/sources.list
deb http://nginx.org/packages/mainline/ubuntu/ trusty nginx
deb-src http://nginx.org/packages/mainline/ubuntu/ trusty nginx
apt-get update
apt-get install nginx

@jwatzman
Copy link
Contributor

Ah, you're using the packages nginx itself provides. Our directions assume you just apt-get install nginx from the official Ubuntu repositories. We should fix this eventually, but low-pri since it only happens if you install a much newer version of nginx yourself.

@jwatzman
Copy link
Contributor

Moving to hhvm/packaging#121

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants