• nginx配置


    在/etc/nginx/conf.d目录下增加虚拟主机配置文件(*.conf):
    server
        {
            listen 80;     #监听端口
            #server_name www.xxxx.cn;
            server_name xxx.xxx.xxx.xxx;    #监听域名
            index index.php index.html index.htm;  # 默认文件

            root /home/vagrant/workspace/www;  #根目录
     
            #error_page   404   /404.html;
       # php扩展支持
            location ~ .php$ {

           try_files $uri =404;
                    include fastcgi.conf;
                    fastcgi_pass 127.0.0.1:9000; # php-fpm 配置中监听地址相对应

            }
       # 路径改写,便于多项目同时工作
            location /test/ {
                    try_files $uri $uri/ /test/public/index.php?$query_string;
            }
       # 状态配置
            location /nginx_status
            {
                stub_status on;
                access_log   off;
            }
       # 静态文件配置
            location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
            {
                expires      30d;
            }

            location ~ .*.(js|css)?$
            {
                expires      12h;
            }

            location ~ /.
            {
                deny all;
            }
        }
    重启nginx: service nginx restart

    ps:配置完成,若不同,检查是否被防火墙过滤,避免防火墙过滤方法:

    1 /etc/sysconfig/iptables 中添加-A INPUT -p tcp --dport 8080 -j ACCEPT

    2 service  iptables restart

  • 相关阅读:
    让你的 Python 代码优雅又地道
    Python3简单爬虫抓取网页图片
    Python 全集变量
    python-ConfigParser模块【读写配置文件】
    Python 第三方插件库
    Python 安装 lxml 插件
    Python cmd中输入'pip' 不是内部或外部命令,也不是可运行的程序或批处理文件。
    SQLServer代理新建或者编辑作业报错
    Python pycharm 常用快捷键
    python 安装插件 requests、BeautifulSoup
  • 原文地址:https://www.cnblogs.com/--xiaoyao--/p/5421076.html
Copyright © 2020-2023  润新知