Mostrando las entradas con la etiqueta nginx. Mostrar todas las entradas
Mostrando las entradas con la etiqueta nginx. Mostrar todas las entradas

viernes, 12 de mayo de 2017

Commands Service NgInx

Commands  Service NgInx
The same commands can be used to start / stop / restart the nginx server on a Ubuntu Linux:
sudo systemctl start nginx 
sudo systemctl stop nginx 
sudo systemctl restart nginx
OR
sudo service nginx start
sudo service nginx stop
sudo service nginx restart
OR
sudo /etc/init.d/nginx start
sudo /etc/init.d/nginx stop
sudo /etc/init.d/nginx restart

martes, 27 de diciembre de 2016

Host Virtual NgInx and PHP 7

Editar

sudo nano /etc/nginx/sites-enabled/default



En file default...

server {
listen 80 default_server;
listen [::]:80 default_server;


root /var/www/html;

# Add index.php to the list if you are using PHP
index index.html index.php index.htm index.nginx-debian.html;

server_name _;

location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
#try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php?$query_string;
}



location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
        }
}



# ======= COMANDO 
# crear una copia al sitio default
sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/apierplife.dev

#colocarlo en sitios enabled
sudo ln -s /etc/nginx/sites-available/apierplife.dev /etc/nginx/sites-enabled/apierplife.dev


# ======= CONFIGURACION DEL VIRTUAL HOST

# Default server configuration
#@armandoaepp
server {
listen 80 ;
listen [::]:80 ;


root /var/www/html/erplife/apierplife/public;

# Add index.php to the list if you are using PHP
index index.html index.php index.htm index.nginx-debian.html;

server_name apierplife.dev;

location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
#try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php?$query_string;
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

=============================
#AGREGARLO HOSTS(sudo nano /etc/hosts)
127.0.0.1 apierplife.dev

REINICIAR SERVE
sudo systemctl restart nginx



=======MAS EJEMPLOS ==========================

crear un nuevo host virtual, por ejemplo tudominio.com(cofemicsa.dev)

# Default server configuration
#
server {
listen 80 ;
listen [::]:80 ;

 

root /var/www/html/cofemicsa/sistcofemicsa/;

# Add index.php to the list if you are using PHP
index index.html index.php index.htm index.nginx-debian.html;

server_name cofemicsa.dev;

location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
#try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php?$query_string;
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
        }
}

For LARAVEL 5.3 
crear un nuevo host virtual, por ejemplo tudominio.com(apicofemicsa.dev)

# Default server configuration
#@armandoaepp
server {
listen 80 ;
listen [::]:80 ;

 

root /var/www/html/cofemicsa/apicofemicsa/public;

# Add index.php to the list if you are using PHP
index index.html index.php index.htm index.nginx-debian.html;

server_name apicofemicsa.dev;

location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
#try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php?$query_string;
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
        }
}

REFERENCIAS  


By Power : @armandoaepp and @tobal2010