1.1 安装Nginx

$sudo apt-get install nginx

  

Ubuntu安装之后的文件结构大致为:

所有的配置文件都在/etc/nginx下,并且每个虚拟主机已经安排在了/etc/nginx/sites-available下

  程序文件在/usr/sbin/nginx

  日志放在了/var/log/nginx中

  并已经在/etc/init.d/下创建了启动脚本nginx

  默认的虚拟主机的目录设置在了/var/www/nginx-default (有的版本 默认的虚拟主机的目录设置在了/var/www, 请参考/etc/nginx/sites-available里的配置)

1.2 启动Nginx

$sudo /etc/init.d/nginx start

[ ok ] Starting nginx (via systemctl): nginx.service.

Nginx的配置文件是 cd /etc/nginx/nginx.conf

vim nginx.conf

cd  /etc/nginx/sites-enabled

vim default

server {
#服务启动时监听的端口
listen 80 default_server;
listen [::]:80 default_server;
#服务启动时文件加载的路径
root /var/www/html/wordpress;
#默认加载的第一个文件
index index.php index.html index.htm index.nginx-debian.html;
#页面访问域名,如果没有域名也可以填写_
server_name www.xiexianbo.xin; location / {
#页面加载失败后所跳转的页面
try_files $uri $uri/ =404;
} #以下配置只服务于php
# 将PHP脚本传递给在127.0.0.1:9000上监听的FastCGI服务器
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php7.0-cgi alone:
#fastcgi_pass 127.0.0.1:9000;
# With php7.0-fpm:
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
} # 如果Apache的文档为root,则拒绝访问.htaccess文件
location ~ /\.ht {
deny all;
}
}

  

  1. 全局配置文件: /etc/nginx/nginx.conf
  2. 站点的配置文件: /etc/nginx/sites-enabled/default
  3. 错误日志文件 : /var/log/nginx/error.log
  4. 访问日志文件 :/var/log/nginx/access.log

新增touch  +文件名

Ubuntu下Nginx安装的更多相关文章

  1. ubuntu 12.04 下nginx安装步骤

    2013-12-05 10:25 2289人阅读 评论(0) 收藏 举报  分类: Ubuntu/Linux(17)  nginx(4)  转自:http://blog.csdn.net/acccca ...

  2. ubuntu下nginx+php5的部署

    ubuntu下nginx+php5环境的部署和centos系统下的部署稍有不同,废话不多说,以下为操作记录:1)nginx安装root@ubuntutest01-KVM:~# sudo apt-get ...

  3. ubuntu server nginx 安装与配置

    ubuntu server nginx 安装与配置 一:关于nginx http://wiki.ubuntu.org.cn/Nginx http://nginx.org/cn http://wiki. ...

  4. Ubuntu下Nginx启动、停止等常用命令

    本文详细介绍Ubuntu下Nginx启动.停止等常用命令.在开发过程中,我们会经常的修改Nginx的配置文件,每次修改配置文件都可以先测试下本次修改的配置文件是否正确,可以利用以下命令: servic ...

  5. VMware Linux 下 Nginx 安装配置 - nginx.conf 配置 [负载两个 Tomcat] (三)

    首先启动Nginx 1. 相关浏览 两个 Tomcat 配置:  VMware Linux 下 Nginx 安装配置 - Tomcat 配置 (二) Nginx 安装配置启动: VMware Linu ...

  6. Ubuntu下软件安装方式、PATH配置、查找安装位置

    Ubuntu 18.04, 安装方式 目前孤知道的Ubuntu下安装软件方式有3种(命令): 1.make 2.apt/apt-get 3.dpkg 方式1基于软件源码安装,需要经历配置(可选).编译 ...

  7. Ubuntu下Zabbix安装及使用问题

    1.configure: error: MySQL library not found MySQL library not found root@kallen:~# apt-get install l ...

  8. Torch7在Ubuntu下的安装与配置

    Torch7的本系列教程的主要目的是介绍Torch的入门使用.今天首先分享一下Torch7的安装.(在Ubuntu14.04安装torch7) 为什么选择Torch Torch的目标是在建立科学算法的 ...

  9. ubuntu下git安装及使用

    ubuntu下git安装及使用   其实,好几个月前,就已经安装好了,可是一直搁置在那儿,所以密码等一些其它细节都忘的差不多了,所以今天就重新部署了一下,并开始积极使用......... 1,git ...

随机推荐

  1. 读取位图(bitmap)实现及其要点

    位图的格式如下: 1.文件头信息块 0000-0001 :文件标识,为字母ASCII码“BM”. 0002-0005 :文件大小. 0006-0009 :保留,每字节以“00”填写. 000A-000 ...

  2. code1052 地鼠游戏

    贪心算法,从后往前 来自codevs的题解: 我的纠结思考过程:如果每一秒都没有重复的地鼠出现 那么肯定是一个一个挨着打如果有重复的地鼠 那么要考虑打那个更优 当然是选分值最大的 单纯这样想很合理 但 ...

  3. C++ STL 全排列函数

    C++  全排列函数...一听名字就在<algorithm>中... 首先第一个说的是next_permutation: #include <algorithm> bool n ...

  4. mosquitto配置文件/etc/mosquitto/mosquitto.conf配置参数详细说明

    mosquitto配置文件/etc/mosquitto/mosquitto.conf配置参数详细说明 摘自:https://blog.csdn.net/weixin_43025071/article/ ...

  5. HBase预分区方法

    (what)什么是预分区? HBase表在刚刚被创建时,只有1个分区(region),当一个region过大(达到hbase.hregion.max.filesize属性中定义的阈值,默认10GB)时 ...

  6. SDN网络工具

    TcpDump 根据使用者的定义对网络上的数据包进行截获的包分析工具. http://www.cnblogs.com/ggjucheng/archive/2012/01/14/2322659.html ...

  7. hdu Lovekey(水题)

    #include<stdio.h> #include<string.h> ]; int main() { ],s2[]; int l1,l2,i,j,k; while(scan ...

  8. springmvc乱码配置

    web.xml配置 <!-- springmvc乱码 --> <filter> <filter-name>encodingFilter</filter-nam ...

  9. 浏览器透明设置例子,qt5.6才支持

    用simpleBrowser例子的基础上,在BrowserWindow构造函数修改如下 BrowserWindow::BrowserWindow(QWidget *parent, Qt::Window ...

  10. PatternLayoutEncoder 输出格式

    ch.qos.logback.classic.encoder.PatternLayoutEncoder ch.qos.logback.classic.PatternLayout ch.qos.logb ...