Skip to content

Instantly share code, notes, and snippets.

@raultm
Last active January 30, 2018 09:42
Show Gist options
  • Save raultm/a2f7e1d7b829eb72aee0df2d13fc4597 to your computer and use it in GitHub Desktop.
Save raultm/a2f7e1d7b829eb72aee0df2d13fc4597 to your computer and use it in GitHub Desktop.
Setup Home Server
# /etc/nginx/sites-available/default
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
try_files $uri $uri/ =404;
}
}
/etc/nginx/sites-available/default
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name server_domain_or_IP;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location ~ /\.ht {
deny all;`.
}
}
# Install NoIp
## Descargamos el cliente
wget http://www.noip.com/client/linux/noip-duc-linux.tar.gz
## Descomprimimos
tar xzf noip-duc-linux.tar.gz
## Nos metemos en la carpeta
cd noip-2.1.9-1
## Construimos el proyecto
sudo make # Si tienen problemas al hacer make, es porque no tienes gcc instalado 'apt-get install gcc'
## Instalamos
sudo make install
## Ejecutar
sudo /usr/local/bin/noip2
# Setup Nginx & PHP7
## (https://www.digitalocean.com/community/tutorials/como-instalar-linux-nginx-mysql-php-lemp-stack-in-ubuntu-16-04-es)
# Actualizamos los repos de apt
sudo apt-get update
# Instalamos Nginx
sudo apt-get install nginx
# Si usas ufw firewall dar acceso
echo "Si usas ufw ejecuta -> sudo ufw allow 'Nginx HTTP'"
echo "Tras hacerlo puedes comprobar con -> sudo ufw status"
# Instalamos PHP
sudo apt-get install php-fpm
# Configurar Nginx para funcionar con PHP
echo "Necesitar editar el archivo -> sudo nano /etc/nginx/sites-available/default"
echo "Así es como está tras instalación https://gist.githubusercontent.com/raultm/a2f7e1d7b829eb72aee0df2d13fc4597/raw/a2f203f614fd47a5b19c95ebd259cf279a24d27f/ngingx_default.conf"
echo "Así es como debe estar para funcionar con php https://gist.githubusercontent.com/raultm/a2f7e1d7b829eb72aee0df2d13fc4597/raw/a2f203f614fd47a5b19c95ebd259cf279a24d27f/nginx_default_with_php.conf"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment